diff --git a/src/main/java/com/google/genai/Client.java b/src/main/java/com/google/genai/Client.java index e1f90b2c24d..f330808f027 100644 --- a/src/main/java/com/google/genai/Client.java +++ b/src/main/java/com/google/genai/Client.java @@ -32,6 +32,7 @@ import com.google.genai.gaos.Webhooks; import com.google.genai.gaos.utils.HTTPClient; import com.google.genai.gaos.utils.Headers; +import com.google.genai.gaos.utils.RetryConfig; import com.google.genai.gaos.utils.transport.HttpBody; import com.google.genai.gaos.utils.transport.HttpRequest; import com.google.genai.gaos.utils.transport.HttpResponse; @@ -417,6 +418,7 @@ private Client( gaosBuilder = gaosBuilder.userProject(apiClient.credentials().getQuotaProjectId()); } gaosBuilder = gaosBuilder.client(new GenAiGaosHttpClient(this.apiClient)); + gaosBuilder = gaosBuilder.retryConfig(RetryConfig.noRetries()); if (asyncRetryScheduler.isPresent()) { gaosBuilder = gaosBuilder.asyncRetryScheduler(asyncRetryScheduler.get()); } diff --git a/src/main/java/com/google/genai/errors/ApiException.java b/src/main/java/com/google/genai/errors/ApiException.java index 437ebae5424..fabc0cc2e5c 100644 --- a/src/main/java/com/google/genai/errors/ApiException.java +++ b/src/main/java/com/google/genai/errors/ApiException.java @@ -51,6 +51,17 @@ public ApiException(int code, String status, String message) { this.message = message; } + /** + * Creates a new ApiException carrying the originating cause (e.g. a reparented gaos error). Lets + * translated interaction errors keep their original stack/message. + */ + public ApiException(int code, String status, String message, Throwable cause) { + super(String.format("%d %s. %s", code, status, message), cause); + this.code = code; + this.status = status; + this.message = message; + } + /** * Throws an ApiException from the response if the response is not a OK status. diff --git a/src/main/java/com/google/genai/errors/ClientException.java b/src/main/java/com/google/genai/errors/ClientException.java index f41bd597aa0..5fc53a49db1 100644 --- a/src/main/java/com/google/genai/errors/ClientException.java +++ b/src/main/java/com/google/genai/errors/ClientException.java @@ -17,10 +17,15 @@ package com.google.genai.errors; /** Client exception raised by the GenAI API. */ -public final class ClientException extends ApiException { +public class ClientException extends ApiException { /** Creates a new ClientException with the specified message. */ public ClientException(int code, String status, String message) { super(code, status, message); } + + /** Creates a new ClientException carrying the originating cause. */ + public ClientException(int code, String status, String message, Throwable cause) { + super(code, status, message, cause); + } } diff --git a/src/main/java/com/google/genai/errors/ServerException.java b/src/main/java/com/google/genai/errors/ServerException.java index 180ce95d282..d17bb135216 100644 --- a/src/main/java/com/google/genai/errors/ServerException.java +++ b/src/main/java/com/google/genai/errors/ServerException.java @@ -17,10 +17,15 @@ package com.google.genai.errors; /** Server exception raised by the GenAI API. */ -public final class ServerException extends ApiException { +public class ServerException extends ApiException { /** Creates a new ServerException with the specified message. */ public ServerException(int code, String status, String message) { super(code, status, message); } + + /** Creates a new ServerException carrying the originating cause. */ + public ServerException(int code, String status, String message, Throwable cause) { + super(code, status, message, cause); + } } diff --git a/src/main/java/com/google/genai/gaos/Agents.java b/src/main/java/com/google/genai/gaos/Agents.java index 01469775c54..637282edfe5 100644 --- a/src/main/java/com/google/genai/gaos/Agents.java +++ b/src/main/java/com/google/genai/gaos/Agents.java @@ -45,7 +45,6 @@ import java.lang.Integer; import java.lang.String; - public class Agents { private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; @@ -58,7 +57,7 @@ public class Agents { /** * Switches to the async SDK. - * + * * @return The async SDK */ public AsyncAgents async() { @@ -67,7 +66,7 @@ public AsyncAgents async() { /** * Creates a new Agent (Typed version for SDK). - * + * * @return The call builder */ public CreateAgentRequestBuilder create() { @@ -76,7 +75,7 @@ public CreateAgentRequestBuilder create() { /** * Creates a new Agent (Typed version for SDK). - * + * * @param body An agent definition for the CreateAgent API. * This message is the target for annotation-parser-based JSON parsing. * New format: @@ -96,7 +95,7 @@ public CreateAgentResponse create(@Nonnull Agent body) { /** * Creates a new Agent (Typed version for SDK). - * + * * @param apiVersion Which version of the API to use. * @param body An agent definition for the CreateAgent API. * This message is the target for annotation-parser-based JSON parsing. @@ -112,18 +111,16 @@ public CreateAgentResponse create(@Nonnull Agent body) { * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public CreateAgentResponse create( - @Nullable String apiVersion, @Nonnull Agent body, - @Nullable Options options) { + public CreateAgentResponse create(@Nullable String apiVersion, @Nonnull Agent body, @Nullable Options options) { CreateAgentRequest request = new CreateAgentRequest(apiVersion, body); - RequestOperation operation - = new CreateAgent.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new CreateAgent.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Lists all Agents. - * + * * @return The call builder */ public ListAgentsRequestBuilder list() { @@ -132,41 +129,40 @@ public ListAgentsRequestBuilder list() { /** * Lists all Agents. - * + * * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ public ListAgentsResponse listDirect() { - return list(null, null, null, - null, null); + return list(null, null, null, null, null); } /** * Lists all Agents. - * + * * @param apiVersion Which version of the API to use. - * @param pageSize - * @param pageToken - * @param parent + * @param pageSize + * @param pageToken + * @param parent * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ public ListAgentsResponse list( - @Nullable String apiVersion, @Nullable Integer pageSize, - @Nullable String pageToken, @Nullable String parent, + @Nullable String apiVersion, + @Nullable Integer pageSize, + @Nullable String pageToken, + @Nullable String parent, @Nullable Options options) { - ListAgentsRequest request = new ListAgentsRequest( - apiVersion, pageSize, pageToken, - parent); - RequestOperation operation - = new ListAgents.Sync(sdkConfiguration, options, _headers); + ListAgentsRequest request = new ListAgentsRequest(apiVersion, pageSize, pageToken, parent); + RequestOperation operation = + new ListAgents.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Gets a specific Agent. - * + * * @return The call builder */ public GetAgentRequestBuilder get() { @@ -175,8 +171,8 @@ public GetAgentRequestBuilder get() { /** * Gets a specific Agent. - * - * @param id + * + * @param id * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ @@ -186,25 +182,23 @@ public GetAgentResponse get(@Nonnull String id) { /** * Gets a specific Agent. - * + * * @param apiVersion Which version of the API to use. - * @param id + * @param id * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public GetAgentResponse get( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { + public GetAgentResponse get(@Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { GetAgentRequest request = new GetAgentRequest(apiVersion, id); - RequestOperation operation - = new GetAgent.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new GetAgent.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Deletes an Agent. - * + * * @return The call builder */ public DeleteAgentRequestBuilder delete() { @@ -213,8 +207,8 @@ public DeleteAgentRequestBuilder delete() { /** * Deletes an Agent. - * - * @param id + * + * @param id * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ @@ -224,20 +218,17 @@ public DeleteAgentResponse delete(@Nonnull String id) { /** * Deletes an Agent. - * + * * @param apiVersion Which version of the API to use. - * @param id + * @param id * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public DeleteAgentResponse delete( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { + public DeleteAgentResponse delete(@Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { DeleteAgentRequest request = new DeleteAgentRequest(apiVersion, id); - RequestOperation operation - = new DeleteAgent.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new DeleteAgent.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } - } diff --git a/src/main/java/com/google/genai/gaos/AsyncAgents.java b/src/main/java/com/google/genai/gaos/AsyncAgents.java index 80f35a53b14..ff6a4d5dbe1 100644 --- a/src/main/java/com/google/genai/gaos/AsyncAgents.java +++ b/src/main/java/com/google/genai/gaos/AsyncAgents.java @@ -47,7 +47,6 @@ import java.lang.String; import java.util.concurrent.CompletableFuture; - public class AsyncAgents { private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; @@ -60,17 +59,16 @@ public class AsyncAgents { /** * Switches to the sync SDK. - * + * * @return The sync SDK */ public Agents sync() { return syncSDK; } - /** * Creates a new Agent (Typed version for SDK). - * + * * @return The async call builder */ public CreateAgentRequestBuilder create() { @@ -79,7 +77,7 @@ public CreateAgentRequestBuilder create() { /** * Creates a new Agent (Typed version for SDK). - * + * * @param body An agent definition for the CreateAgent API. * This message is the target for annotation-parser-based JSON parsing. * New format: @@ -98,7 +96,7 @@ public CompletableFuture create(@Nonnull Agent body) { /** * Creates a new Agent (Typed version for SDK). - * + * * @param apiVersion Which version of the API to use. * @param body An agent definition for the CreateAgent API. * This message is the target for annotation-parser-based JSON parsing. @@ -114,21 +112,17 @@ public CompletableFuture create(@Nonnull Agent body) { * @return {@code CompletableFuture} - The async response */ public CompletableFuture create( - @Nullable String apiVersion, @Nonnull Agent body, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull Agent body, @Nullable Options options) { CreateAgentRequest request = new CreateAgentRequest(apiVersion, body); - AsyncRequestOperation operation - = new CreateAgent.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new CreateAgent.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Lists all Agents. - * + * * @return The async call builder */ public ListAgentsRequestBuilder list() { @@ -137,44 +131,39 @@ public ListAgentsRequestBuilder list() { /** * Lists all Agents. - * + * * @return {@code CompletableFuture} - The async response */ public CompletableFuture listDirect() { - return list( - null, null, null, - null, null); + return list(null, null, null, null, null); } /** * Lists all Agents. - * + * * @param apiVersion Which version of the API to use. - * @param pageSize - * @param pageToken - * @param parent + * @param pageSize + * @param pageToken + * @param parent * @param options additional options * @return {@code CompletableFuture} - The async response */ public CompletableFuture list( - @Nullable String apiVersion, @Nullable Integer pageSize, - @Nullable String pageToken, @Nullable String parent, + @Nullable String apiVersion, + @Nullable Integer pageSize, + @Nullable String pageToken, + @Nullable String parent, @Nullable Options options) { - ListAgentsRequest request = new ListAgentsRequest( - apiVersion, pageSize, pageToken, - parent); - AsyncRequestOperation operation - = new ListAgents.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + ListAgentsRequest request = new ListAgentsRequest(apiVersion, pageSize, pageToken, parent); + AsyncRequestOperation operation = + new ListAgents.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Gets a specific Agent. - * + * * @return The async call builder */ public GetAgentRequestBuilder get() { @@ -183,8 +172,8 @@ public GetAgentRequestBuilder get() { /** * Gets a specific Agent. - * - * @param id + * + * @param id * @return {@code CompletableFuture} - The async response */ public CompletableFuture get(@Nonnull String id) { @@ -193,28 +182,24 @@ public CompletableFuture get(@Nonnull String id) { /** * Gets a specific Agent. - * + * * @param apiVersion Which version of the API to use. - * @param id + * @param id * @param options additional options * @return {@code CompletableFuture} - The async response */ public CompletableFuture get( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { GetAgentRequest request = new GetAgentRequest(apiVersion, id); - AsyncRequestOperation operation - = new GetAgent.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new GetAgent.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Deletes an Agent. - * + * * @return The async call builder */ public DeleteAgentRequestBuilder delete() { @@ -223,8 +208,8 @@ public DeleteAgentRequestBuilder delete() { /** * Deletes an Agent. - * - * @param id + * + * @param id * @return {@code CompletableFuture} - The async response */ public CompletableFuture delete(@Nonnull String id) { @@ -233,22 +218,18 @@ public CompletableFuture delete(@Nonnull String id) { /** * Deletes an Agent. - * + * * @param apiVersion Which version of the API to use. - * @param id + * @param id * @param options additional options * @return {@code CompletableFuture} - The async response */ public CompletableFuture delete( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { DeleteAgentRequest request = new DeleteAgentRequest(apiVersion, id); - AsyncRequestOperation operation - = new DeleteAgent.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new DeleteAgent.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - } diff --git a/src/main/java/com/google/genai/gaos/AsyncEnvironments.java b/src/main/java/com/google/genai/gaos/AsyncEnvironments.java index c2fcad9db52..e5543a0594e 100644 --- a/src/main/java/com/google/genai/gaos/AsyncEnvironments.java +++ b/src/main/java/com/google/genai/gaos/AsyncEnvironments.java @@ -46,7 +46,6 @@ import java.lang.String; import java.util.concurrent.CompletableFuture; - public class AsyncEnvironments { private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; @@ -59,17 +58,16 @@ public class AsyncEnvironments { /** * Switches to the sync SDK. - * + * * @return The sync SDK */ public Environments sync() { return syncSDK; } - /** * Creates an environment. - * + * * @return The async call builder */ public CreateEnvironmentRequestBuilder createEnvironment() { @@ -78,7 +76,7 @@ public CreateEnvironmentRequestBuilder createEnvironment() { /** * Creates an environment. - * + * * @param body Request for `CreateEnvironment`. * @return {@code CompletableFuture} - The async response */ @@ -88,28 +86,25 @@ public CompletableFuture createEnvironment(@Nonnull C /** * Creates an environment. - * + * * @param apiVersion Which version of the API to use. * @param body Request for `CreateEnvironment`. * @param options additional options * @return {@code CompletableFuture} - The async response */ public CompletableFuture createEnvironment( - @Nullable String apiVersion, @Nonnull CreateEnvironmentRequest body, - @Nullable Options options) { - com.google.genai.gaos.models.operations.CreateEnvironmentRequest request = new com.google.genai.gaos.models.operations.CreateEnvironmentRequest(apiVersion, body); - AsyncRequestOperation operation - = new CreateEnvironment.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + @Nullable String apiVersion, @Nonnull CreateEnvironmentRequest body, @Nullable Options options) { + com.google.genai.gaos.models.operations.CreateEnvironmentRequest request = + new com.google.genai.gaos.models.operations.CreateEnvironmentRequest(apiVersion, body); + AsyncRequestOperation operation = + new CreateEnvironment.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Lists environments. - * + * * @return The async call builder */ public ListEnvironmentsRequestBuilder listEnvironments() { @@ -118,18 +113,16 @@ public ListEnvironmentsRequestBuilder listEnvironments() { /** * Lists environments. - * + * * @return {@code CompletableFuture} - The async response */ public CompletableFuture listEnvironmentsDirect() { - return listEnvironments( - null, null, null, - null); + return listEnvironments(null, null, null, null); } /** * Lists environments. - * + * * @param apiVersion Which version of the API to use. * @param pageSize Optional. Maximum number of environments to return.\nIf unspecified, defaults to 50. Maximum is 1000. * @param pageToken Optional. Pagination token. @@ -137,21 +130,20 @@ public CompletableFuture listEnvironmentsDirect() { * @return {@code CompletableFuture} - The async response */ public CompletableFuture listEnvironments( - @Nullable String apiVersion, @Nullable Integer pageSize, - @Nullable String pageToken, @Nullable Options options) { + @Nullable String apiVersion, + @Nullable Integer pageSize, + @Nullable String pageToken, + @Nullable Options options) { ListEnvironmentsRequest request = new ListEnvironmentsRequest(apiVersion, pageSize, pageToken); - AsyncRequestOperation operation - = new ListEnvironments.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new ListEnvironments.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Gets an environment. - * + * * @return The async call builder */ public GetEnvironmentRequestBuilder getEnvironment() { @@ -160,7 +152,7 @@ public GetEnvironmentRequestBuilder getEnvironment() { /** * Gets an environment. - * + * * @param id Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. * @return {@code CompletableFuture} - The async response */ @@ -170,28 +162,24 @@ public CompletableFuture getEnvironment(@Nonnull String /** * Gets an environment. - * + * * @param apiVersion Which version of the API to use. * @param id Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. * @param options additional options * @return {@code CompletableFuture} - The async response */ public CompletableFuture getEnvironment( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { GetEnvironmentRequest request = new GetEnvironmentRequest(apiVersion, id); - AsyncRequestOperation operation - = new GetEnvironment.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new GetEnvironment.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Deletes an environment. - * + * * @return The async call builder */ public DeleteEnvironmentRequestBuilder deleteEnvironment() { @@ -200,7 +188,7 @@ public DeleteEnvironmentRequestBuilder deleteEnvironment() { /** * Deletes an environment. - * + * * @param id Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. * @return {@code CompletableFuture} - The async response */ @@ -210,22 +198,18 @@ public CompletableFuture deleteEnvironment(@Nonnull S /** * Deletes an environment. - * + * * @param apiVersion Which version of the API to use. * @param id Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. * @param options additional options * @return {@code CompletableFuture} - The async response */ public CompletableFuture deleteEnvironment( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { DeleteEnvironmentRequest request = new DeleteEnvironmentRequest(apiVersion, id); - AsyncRequestOperation operation - = new DeleteEnvironment.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new DeleteEnvironment.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - } diff --git a/src/main/java/com/google/genai/gaos/AsyncGenAI.java b/src/main/java/com/google/genai/gaos/AsyncGenAI.java index c1b0dcd9378..37225b365ca 100644 --- a/src/main/java/com/google/genai/gaos/AsyncGenAI.java +++ b/src/main/java/com/google/genai/gaos/AsyncGenAI.java @@ -26,11 +26,11 @@ * Gemini models. Gemini is our most capable model, built from the ground up to be multimodal. It can * generalize and seamlessly understand, operate across, and combine different types of information * including language, images, audio, video, and code. - * + * *

You can use the Gemini API for use cases like reasoning across text and images, content generation, * dialogue agents, summarization and classification systems, and more. */ -public class AsyncGenAI { +public class AsyncGenAI implements java.lang.AutoCloseable { private static final Headers _headers = Headers.EMPTY; private final AsyncInteractions interactions; @@ -78,10 +78,21 @@ public AsyncEnvironments environments() { /** * Switches to the sync SDK. - * + * * @return The sync SDK */ public GenAI sync() { return syncSDK; } + + /** + * Releases the configured HTTP client's owned resources. The sync and + * async SDKs share one client, which is closed at most once. + * + * @throws Exception if the configured client cannot be closed + */ + @Override + public void close() throws Exception { + this.sdkConfiguration.closeClient(); + } } diff --git a/src/main/java/com/google/genai/gaos/AsyncInteractions.java b/src/main/java/com/google/genai/gaos/AsyncInteractions.java index 580346880f0..9448421738e 100644 --- a/src/main/java/com/google/genai/gaos/AsyncInteractions.java +++ b/src/main/java/com/google/genai/gaos/AsyncInteractions.java @@ -51,7 +51,6 @@ import java.util.Optional; import java.util.concurrent.CompletableFuture; - public class AsyncInteractions { private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; @@ -64,19 +63,18 @@ public class AsyncInteractions { /** * Switches to the sync SDK. - * + * * @return The sync SDK */ public Interactions sync() { return syncSDK; } - /** * Creating an interaction - * + * *

Creates a new interaction. - * + * * @return The async call builder */ public CreateInteractionRequestBuilder create() { @@ -85,21 +83,22 @@ public CreateInteractionRequestBuilder create() { /** * Creating an interaction - * + * *

Creates a new interaction. - * + * * @param body The request body. * @return {@code CompletableFuture}> - The async response */ - public CompletableFuture> create(@Nonnull CreateInteractionRequestBody body) { + public CompletableFuture> create( + @Nonnull CreateInteractionRequestBody body) { return create(null, body, null); } /** * Creating an interaction - * + * *

Creates a new interaction. - * + * * @param apiVersion Which version of the API to use. * @param body The request body. * @param options additional options @@ -107,29 +106,27 @@ public CompletableFuture> create(@Nonnull * Iterating the stream blocks the calling thread; close it after use. */ public CompletableFuture> create( - @Nullable String apiVersion, @Nonnull CreateInteractionRequestBody body, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull CreateInteractionRequestBody body, @Nullable Options options) { CreateInteractionRequest request = new CreateInteractionRequest(apiVersion, body); - AsyncRequestOperation operation - = new CreateInteraction.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse) - .thenApplyAsync(response -> new EventStream( - response.rawResponse().body(), - new TypeReference() { - }, - Utils.mapper(), - Optional.of("[DONE]")), Operations.streamCompletionExecutor()), operation); + AsyncRequestOperation operation = + new CreateInteraction.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse) + .thenApplyAsync( + response -> new EventStream( + response.rawResponse().body(), + new TypeReference() {}, + Utils.mapper(), + Optional.of("[DONE]")), + Operations.streamCompletionExecutor()), + operation); } - /** * Retrieving an interaction - * + * *

Retrieves the full details of a single interaction based on its `Interaction.id`. - * + * * @return The async call builder */ public GetInteractionByIdRequestBuilder get() { @@ -138,9 +135,9 @@ public GetInteractionByIdRequestBuilder get() { /** * Retrieving an interaction - * + * *

Retrieves the full details of a single interaction based on its `Interaction.id`. - * + * * @param request The request object containing all the parameters for the API call. * @return {@code CompletableFuture}> - The async response */ @@ -150,35 +147,35 @@ public CompletableFuture> get(@Nonnull Ge /** * Retrieving an interaction - * + * *

Retrieves the full details of a single interaction based on its `Interaction.id`. - * + * * @param request The request object containing all the parameters for the API call. * @param options additional options * @return A CompletableFuture that completes with a blocking event stream once response headers are received. * Iterating the stream blocks the calling thread; close it after use. */ - public CompletableFuture> get(@Nonnull GetInteractionByIdRequest request, @Nullable Options options) { - AsyncRequestOperation operation - = new GetInteractionById.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse) - .thenApplyAsync(response -> new EventStream( - response.rawResponse().body(), - new TypeReference() { - }, - Utils.mapper(), - Optional.of("[DONE]")), Operations.streamCompletionExecutor()), operation); + public CompletableFuture> get( + @Nonnull GetInteractionByIdRequest request, @Nullable Options options) { + AsyncRequestOperation operation = + new GetInteractionById.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse) + .thenApplyAsync( + response -> new EventStream( + response.rawResponse().body(), + new TypeReference() {}, + Utils.mapper(), + Optional.of("[DONE]")), + Operations.streamCompletionExecutor()), + operation); } - /** * Deleting an interaction - * + * *

Deletes the interaction by id. - * + * * @return The async call builder */ public DeleteInteractionRequestBuilder delete() { @@ -187,9 +184,9 @@ public DeleteInteractionRequestBuilder delete() { /** * Deleting an interaction - * + * *

Deletes the interaction by id. - * + * * @param id The unique identifier of the interaction to delete. * @return {@code CompletableFuture} - The async response */ @@ -199,32 +196,28 @@ public CompletableFuture delete(@Nonnull String id) { /** * Deleting an interaction - * + * *

Deletes the interaction by id. - * + * * @param id The unique identifier of the interaction to delete. * @param apiVersion Which version of the API to use. * @param options additional options * @return {@code CompletableFuture} - The async response */ public CompletableFuture delete( - @Nonnull String id, @Nullable String apiVersion, - @Nullable Options options) { + @Nonnull String id, @Nullable String apiVersion, @Nullable Options options) { DeleteInteractionRequest request = new DeleteInteractionRequest(id, apiVersion); - AsyncRequestOperation operation - = new DeleteInteraction.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new DeleteInteraction.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Canceling an interaction - * + * *

Cancels an interaction by id. This only applies to background interactions that are still running. - * + * * @return The async call builder */ public CancelInteractionByIdRequestBuilder cancel() { @@ -233,9 +226,9 @@ public CancelInteractionByIdRequestBuilder cancel() { /** * Canceling an interaction - * + * *

Cancels an interaction by id. This only applies to background interactions that are still running. - * + * * @param id The unique identifier of the interaction to cancel. * @return {@code CompletableFuture} - The async response */ @@ -245,24 +238,20 @@ public CompletableFuture cancel(@Nonnull String i /** * Canceling an interaction - * + * *

Cancels an interaction by id. This only applies to background interactions that are still running. - * + * * @param id The unique identifier of the interaction to cancel. * @param apiVersion Which version of the API to use. * @param options additional options * @return {@code CompletableFuture} - The async response */ public CompletableFuture cancel( - @Nonnull String id, @Nullable String apiVersion, - @Nullable Options options) { + @Nonnull String id, @Nullable String apiVersion, @Nullable Options options) { CancelInteractionByIdRequest request = new CancelInteractionByIdRequest(id, apiVersion); - AsyncRequestOperation operation - = new CancelInteractionById.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new CancelInteractionById.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - } diff --git a/src/main/java/com/google/genai/gaos/AsyncTriggers.java b/src/main/java/com/google/genai/gaos/AsyncTriggers.java index 01e8f2f631f..87449fb4348 100644 --- a/src/main/java/com/google/genai/gaos/AsyncTriggers.java +++ b/src/main/java/com/google/genai/gaos/AsyncTriggers.java @@ -60,7 +60,6 @@ import java.lang.String; import java.util.concurrent.CompletableFuture; - public class AsyncTriggers { private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; @@ -73,17 +72,16 @@ public class AsyncTriggers { /** * Switches to the sync SDK. - * + * * @return The sync SDK */ public Triggers sync() { return syncSDK; } - /** * Creates a new trigger that will invoke the specified agent on the given cron schedule. - * + * * @return The async call builder */ public CreateTriggerRequestBuilder create() { @@ -92,7 +90,7 @@ public CreateTriggerRequestBuilder create() { /** * Creates a new trigger that will invoke the specified agent on the given cron schedule. - * + * * @param body Parameters for creating a trigger. * @return {@code CompletableFuture} - The async response */ @@ -102,28 +100,24 @@ public CompletableFuture create(@Nonnull TriggerCreatePar /** * Creates a new trigger that will invoke the specified agent on the given cron schedule. - * + * * @param apiVersion Which version of the API to use. * @param body Parameters for creating a trigger. * @param options additional options * @return {@code CompletableFuture} - The async response */ public CompletableFuture create( - @Nullable String apiVersion, @Nonnull TriggerCreateParams body, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull TriggerCreateParams body, @Nullable Options options) { CreateTriggerRequest request = new CreateTriggerRequest(apiVersion, body); - AsyncRequestOperation operation - = new CreateTrigger.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new CreateTrigger.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Lists triggers for a project. - * + * * @return The async call builder */ public ListTriggersRequestBuilder list() { @@ -132,18 +126,16 @@ public ListTriggersRequestBuilder list() { /** * Lists triggers for a project. - * + * * @return {@code CompletableFuture} - The async response */ public CompletableFuture listDirect() { - return list( - null, null, null, - null, null); + return list(null, null, null, null, null); } /** * Lists triggers for a project. - * + * * @param apiVersion Which version of the API to use. * @param filter Optional. Filter expression (e.g., by state). * @param pageSize Optional. The maximum number of triggers to return per page. @@ -152,24 +144,21 @@ public CompletableFuture listDirect() { * @return {@code CompletableFuture} - The async response */ public CompletableFuture list( - @Nullable String apiVersion, @Nullable String filter, - @Nullable Long pageSize, @Nullable String pageToken, + @Nullable String apiVersion, + @Nullable String filter, + @Nullable Long pageSize, + @Nullable String pageToken, @Nullable Options options) { - ListTriggersRequest request = new ListTriggersRequest( - apiVersion, filter, pageSize, - pageToken); - AsyncRequestOperation operation - = new ListTriggers.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + ListTriggersRequest request = new ListTriggersRequest(apiVersion, filter, pageSize, pageToken); + AsyncRequestOperation operation = + new ListTriggers.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Gets details of a single trigger. - * + * * @return The async call builder */ public GetTriggerRequestBuilder get() { @@ -178,7 +167,7 @@ public GetTriggerRequestBuilder get() { /** * Gets details of a single trigger. - * + * * @param id Resource name of the trigger. * @return {@code CompletableFuture} - The async response */ @@ -188,28 +177,24 @@ public CompletableFuture get(@Nonnull String id) { /** * Gets details of a single trigger. - * + * * @param apiVersion Which version of the API to use. * @param id Resource name of the trigger. * @param options additional options * @return {@code CompletableFuture} - The async response */ public CompletableFuture get( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { GetTriggerRequest request = new GetTriggerRequest(apiVersion, id); - AsyncRequestOperation operation - = new GetTrigger.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new GetTrigger.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Updates a trigger. - * + * * @return The async call builder */ public UpdateTriggerRequestBuilder update() { @@ -218,20 +203,18 @@ public UpdateTriggerRequestBuilder update() { /** * Updates a trigger. - * + * * @param id Resource name of the trigger. * @param body Represents the fields of a Trigger that can be updated. * @return {@code CompletableFuture} - The async response */ public CompletableFuture update(@Nonnull String id, @Nonnull TriggerUpdate body) { - return update( - null, id, body, - null); + return update(null, id, body, null); } /** * Updates a trigger. - * + * * @param apiVersion Which version of the API to use. * @param id Resource name of the trigger. * @param body Represents the fields of a Trigger that can be updated. @@ -239,21 +222,17 @@ public CompletableFuture update(@Nonnull String id, @Nonn * @return {@code CompletableFuture} - The async response */ public CompletableFuture update( - @Nullable String apiVersion, @Nonnull String id, - @Nonnull TriggerUpdate body, @Nullable Options options) { + @Nullable String apiVersion, @Nonnull String id, @Nonnull TriggerUpdate body, @Nullable Options options) { UpdateTriggerRequest request = new UpdateTriggerRequest(apiVersion, id, body); - AsyncRequestOperation operation - = new UpdateTrigger.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new UpdateTrigger.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Deletes a trigger. - * + * * @return The async call builder */ public DeleteTriggerRequestBuilder delete() { @@ -262,7 +241,7 @@ public DeleteTriggerRequestBuilder delete() { /** * Deletes a trigger. - * + * * @param id Resource name of the trigger. * @return {@code CompletableFuture} - The async response */ @@ -272,28 +251,24 @@ public CompletableFuture delete(@Nonnull String id) { /** * Deletes a trigger. - * + * * @param apiVersion Which version of the API to use. * @param id Resource name of the trigger. * @param options additional options * @return {@code CompletableFuture} - The async response */ public CompletableFuture delete( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { DeleteTriggerRequest request = new DeleteTriggerRequest(apiVersion, id); - AsyncRequestOperation operation - = new DeleteTrigger.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new DeleteTrigger.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Runs a trigger immediately. - * + * * @return The async call builder */ public RunTriggerRequestBuilder run() { @@ -302,7 +277,7 @@ public RunTriggerRequestBuilder run() { /** * Runs a trigger immediately. - * + * * @param triggerId Resource name of the trigger. * @return {@code CompletableFuture} - The async response */ @@ -312,28 +287,24 @@ public CompletableFuture run(@Nonnull String triggerId) { /** * Runs a trigger immediately. - * + * * @param apiVersion Which version of the API to use. * @param triggerId Resource name of the trigger. * @param options additional options * @return {@code CompletableFuture} - The async response */ public CompletableFuture run( - @Nullable String apiVersion, @Nonnull String triggerId, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull String triggerId, @Nullable Options options) { RunTriggerRequest request = new RunTriggerRequest(apiVersion, triggerId); - AsyncRequestOperation operation - = new RunTrigger.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new RunTrigger.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Lists executions for a trigger. - * + * * @return The async call builder */ public ListTriggerExecutionsRequestBuilder listExecutions() { @@ -342,19 +313,17 @@ public ListTriggerExecutionsRequestBuilder listExecutions() { /** * Lists executions for a trigger. - * + * * @param triggerId Resource name of the trigger. * @return {@code CompletableFuture} - The async response */ public CompletableFuture listExecutions(@Nonnull String triggerId) { - return listExecutions( - null, triggerId, null, - null, null); + return listExecutions(null, triggerId, null, null, null); } /** * Lists executions for a trigger. - * + * * @param apiVersion Which version of the API to use. * @param triggerId Resource name of the trigger. * @param pageSize Optional. The maximum number of executions to return per page. @@ -363,18 +332,16 @@ public CompletableFuture listExecutions(@Nonnull * @return {@code CompletableFuture} - The async response */ public CompletableFuture listExecutions( - @Nullable String apiVersion, @Nonnull String triggerId, - @Nullable Long pageSize, @Nullable String pageToken, + @Nullable String apiVersion, + @Nonnull String triggerId, + @Nullable Long pageSize, + @Nullable String pageToken, @Nullable Options options) { - ListTriggerExecutionsRequest request = new ListTriggerExecutionsRequest( - apiVersion, triggerId, pageSize, - pageToken); - AsyncRequestOperation operation - = new ListTriggerExecutions.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + ListTriggerExecutionsRequest request = + new ListTriggerExecutionsRequest(apiVersion, triggerId, pageSize, pageToken); + AsyncRequestOperation operation = + new ListTriggerExecutions.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - } diff --git a/src/main/java/com/google/genai/gaos/AsyncWebhooks.java b/src/main/java/com/google/genai/gaos/AsyncWebhooks.java index e761dd8db53..031c0deb40c 100644 --- a/src/main/java/com/google/genai/gaos/AsyncWebhooks.java +++ b/src/main/java/com/google/genai/gaos/AsyncWebhooks.java @@ -60,7 +60,6 @@ import java.lang.String; import java.util.concurrent.CompletableFuture; - public class AsyncWebhooks { private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; @@ -73,17 +72,16 @@ public class AsyncWebhooks { /** * Switches to the sync SDK. - * + * * @return The sync SDK */ public Webhooks sync() { return syncSDK; } - /** * Creates a new Webhook. - * + * * @return The async call builder */ public CreateWebhookRequestBuilder create() { @@ -92,7 +90,7 @@ public CreateWebhookRequestBuilder create() { /** * Creates a new Webhook. - * + * * @param body A Webhook resource. * @return {@code CompletableFuture} - The async response */ @@ -102,28 +100,24 @@ public CompletableFuture create(@Nonnull WebhookInput bod /** * Creates a new Webhook. - * + * * @param apiVersion Which version of the API to use. * @param body A Webhook resource. * @param options additional options * @return {@code CompletableFuture} - The async response */ public CompletableFuture create( - @Nullable String apiVersion, @Nonnull WebhookInput body, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull WebhookInput body, @Nullable Options options) { CreateWebhookRequest request = new CreateWebhookRequest(apiVersion, body); - AsyncRequestOperation operation - = new CreateWebhook.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new CreateWebhook.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Lists all Webhooks. - * + * * @return The async call builder */ public ListWebhooksRequestBuilder list() { @@ -132,18 +126,16 @@ public ListWebhooksRequestBuilder list() { /** * Lists all Webhooks. - * + * * @return {@code CompletableFuture} - The async response */ public CompletableFuture listDirect() { - return list( - null, null, null, - null); + return list(null, null, null, null); } /** * Lists all Webhooks. - * + * * @param apiVersion Which version of the API to use. * @param pageSize Optional. The maximum number of webhooks to return. The service may return fewer than * this value. If unspecified, at most 50 webhooks will be returned. @@ -154,21 +146,20 @@ public CompletableFuture listDirect() { * @return {@code CompletableFuture} - The async response */ public CompletableFuture list( - @Nullable String apiVersion, @Nullable Integer pageSize, - @Nullable String pageToken, @Nullable Options options) { + @Nullable String apiVersion, + @Nullable Integer pageSize, + @Nullable String pageToken, + @Nullable Options options) { ListWebhooksRequest request = new ListWebhooksRequest(apiVersion, pageSize, pageToken); - AsyncRequestOperation operation - = new ListWebhooks.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new ListWebhooks.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Gets a specific Webhook. - * + * * @return The async call builder */ public GetWebhookRequestBuilder get() { @@ -177,7 +168,7 @@ public GetWebhookRequestBuilder get() { /** * Gets a specific Webhook. - * + * * @param id Required. The ID of the webhook to retrieve. * @return {@code CompletableFuture} - The async response */ @@ -187,28 +178,24 @@ public CompletableFuture get(@Nonnull String id) { /** * Gets a specific Webhook. - * + * * @param apiVersion Which version of the API to use. * @param id Required. The ID of the webhook to retrieve. * @param options additional options * @return {@code CompletableFuture} - The async response */ public CompletableFuture get( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { GetWebhookRequest request = new GetWebhookRequest(apiVersion, id); - AsyncRequestOperation operation - = new GetWebhook.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new GetWebhook.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Updates an existing Webhook. - * + * * @return The async call builder */ public UpdateWebhookRequestBuilder update() { @@ -217,45 +204,40 @@ public UpdateWebhookRequestBuilder update() { /** * Updates an existing Webhook. - * + * * @param id Required. The ID of the webhook to update. * @return {@code CompletableFuture} - The async response */ public CompletableFuture update(@Nonnull String id) { - return update( - null, id, null, - null, null); + return update(null, id, null, null, null); } /** * Updates an existing Webhook. - * + * * @param apiVersion Which version of the API to use. * @param id Required. The ID of the webhook to update. * @param updateMask Optional. The list of fields to update. - * @param body + * @param body * @param options additional options * @return {@code CompletableFuture} - The async response */ public CompletableFuture update( - @Nullable String apiVersion, @Nonnull String id, - @Nullable String updateMask, @Nullable WebhookUpdate body, + @Nullable String apiVersion, + @Nonnull String id, + @Nullable String updateMask, + @Nullable WebhookUpdate body, @Nullable Options options) { - UpdateWebhookRequest request = new UpdateWebhookRequest( - apiVersion, id, updateMask, - body); - AsyncRequestOperation operation - = new UpdateWebhook.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + UpdateWebhookRequest request = new UpdateWebhookRequest(apiVersion, id, updateMask, body); + AsyncRequestOperation operation = + new UpdateWebhook.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Deletes a Webhook. - * + * * @return The async call builder */ public DeleteWebhookRequestBuilder delete() { @@ -264,7 +246,7 @@ public DeleteWebhookRequestBuilder delete() { /** * Deletes a Webhook. - * + * * @param id Required. The ID of the webhook to delete. * Format: `{webhook_id}` * @return {@code CompletableFuture} - The async response @@ -275,7 +257,7 @@ public CompletableFuture delete(@Nonnull String id) { /** * Deletes a Webhook. - * + * * @param apiVersion Which version of the API to use. * @param id Required. The ID of the webhook to delete. * Format: `{webhook_id}` @@ -283,21 +265,17 @@ public CompletableFuture delete(@Nonnull String id) { * @return {@code CompletableFuture} - The async response */ public CompletableFuture delete( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { DeleteWebhookRequest request = new DeleteWebhookRequest(apiVersion, id); - AsyncRequestOperation operation - = new DeleteWebhook.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new DeleteWebhook.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Generates a new signing secret for a Webhook. - * + * * @return The async call builder */ public RotateSigningSecretRequestBuilder rotateSigningSecret() { @@ -306,20 +284,18 @@ public RotateSigningSecretRequestBuilder rotateSigningSecret() { /** * Generates a new signing secret for a Webhook. - * + * * @param id Required. The ID of the webhook for which to generate a signing secret. * Format: `{webhook_id}` * @return {@code CompletableFuture} - The async response */ public CompletableFuture rotateSigningSecret(@Nonnull String id) { - return rotateSigningSecret( - null, id, null, - null); + return rotateSigningSecret(null, id, null, null); } /** * Generates a new signing secret for a Webhook. - * + * * @param apiVersion Which version of the API to use. * @param id Required. The ID of the webhook for which to generate a signing secret. * Format: `{webhook_id}` @@ -328,21 +304,23 @@ public CompletableFuture rotateSigningSecret(@Nonnu * @return {@code CompletableFuture} - The async response */ public CompletableFuture rotateSigningSecret( - @Nullable String apiVersion, @Nonnull String id, - @Nullable RotateSigningSecretRequest body, @Nullable Options options) { - com.google.genai.gaos.models.operations.RotateSigningSecretRequest request = new com.google.genai.gaos.models.operations.RotateSigningSecretRequest(apiVersion, id, body); - AsyncRequestOperation operation - = new RotateSigningSecret.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + @Nullable String apiVersion, + @Nonnull String id, + @Nullable RotateSigningSecretRequest body, + @Nullable Options options) { + com.google.genai.gaos.models.operations.RotateSigningSecretRequest request = + new com.google.genai.gaos.models.operations.RotateSigningSecretRequest(apiVersion, id, body); + AsyncRequestOperation< + com.google.genai.gaos.models.operations.RotateSigningSecretRequest, RotateSigningSecretResponse> + operation = new RotateSigningSecret.Async( + sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - /** * Sends a ping event to a Webhook. - * + * * @return The async call builder */ public PingWebhookRequestBuilder ping() { @@ -351,20 +329,18 @@ public PingWebhookRequestBuilder ping() { /** * Sends a ping event to a Webhook. - * + * * @param id Required. The ID of the webhook to ping. * Format: `{webhook_id}` * @return {@code CompletableFuture} - The async response */ public CompletableFuture ping(@Nonnull String id) { - return ping( - null, id, null, - null); + return ping(null, id, null, null); } /** * Sends a ping event to a Webhook. - * + * * @param apiVersion Which version of the API to use. * @param id Required. The ID of the webhook to ping. * Format: `{webhook_id}` @@ -373,15 +349,15 @@ public CompletableFuture ping(@Nonnull String id) { * @return {@code CompletableFuture} - The async response */ public CompletableFuture ping( - @Nullable String apiVersion, @Nonnull String id, - @Nullable PingWebhookRequest body, @Nullable Options options) { - com.google.genai.gaos.models.operations.PingWebhookRequest request = new com.google.genai.gaos.models.operations.PingWebhookRequest(apiVersion, id, body); - AsyncRequestOperation operation - = new PingWebhook.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); + @Nullable String apiVersion, + @Nonnull String id, + @Nullable PingWebhookRequest body, + @Nullable Options options) { + com.google.genai.gaos.models.operations.PingWebhookRequest request = + new com.google.genai.gaos.models.operations.PingWebhookRequest(apiVersion, id, body); + AsyncRequestOperation operation = + new PingWebhook.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(request), operation::handleResponse), operation); } - } diff --git a/src/main/java/com/google/genai/gaos/Environments.java b/src/main/java/com/google/genai/gaos/Environments.java index d1dcc7e6b5c..bd830803b30 100644 --- a/src/main/java/com/google/genai/gaos/Environments.java +++ b/src/main/java/com/google/genai/gaos/Environments.java @@ -44,7 +44,6 @@ import java.lang.Integer; import java.lang.String; - public class Environments { private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; @@ -57,7 +56,7 @@ public class Environments { /** * Switches to the async SDK. - * + * * @return The async SDK */ public AsyncEnvironments async() { @@ -66,7 +65,7 @@ public AsyncEnvironments async() { /** * Creates an environment. - * + * * @return The call builder */ public CreateEnvironmentRequestBuilder createEnvironment() { @@ -75,7 +74,7 @@ public CreateEnvironmentRequestBuilder createEnvironment() { /** * Creates an environment. - * + * * @param body Request for `CreateEnvironment`. * @return The response from the API call * @throws RuntimeException subclass if the API call fails @@ -86,7 +85,7 @@ public CreateEnvironmentResponse createEnvironment(@Nonnull CreateEnvironmentReq /** * Creates an environment. - * + * * @param apiVersion Which version of the API to use. * @param body Request for `CreateEnvironment`. * @param options additional options @@ -94,17 +93,17 @@ public CreateEnvironmentResponse createEnvironment(@Nonnull CreateEnvironmentReq * @throws RuntimeException subclass if the API call fails */ public CreateEnvironmentResponse createEnvironment( - @Nullable String apiVersion, @Nonnull CreateEnvironmentRequest body, - @Nullable Options options) { - com.google.genai.gaos.models.operations.CreateEnvironmentRequest request = new com.google.genai.gaos.models.operations.CreateEnvironmentRequest(apiVersion, body); - RequestOperation operation - = new CreateEnvironment.Sync(sdkConfiguration, options, _headers); + @Nullable String apiVersion, @Nonnull CreateEnvironmentRequest body, @Nullable Options options) { + com.google.genai.gaos.models.operations.CreateEnvironmentRequest request = + new com.google.genai.gaos.models.operations.CreateEnvironmentRequest(apiVersion, body); + RequestOperation operation = + new CreateEnvironment.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Lists environments. - * + * * @return The call builder */ public ListEnvironmentsRequestBuilder listEnvironments() { @@ -113,18 +112,17 @@ public ListEnvironmentsRequestBuilder listEnvironments() { /** * Lists environments. - * + * * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ public ListEnvironmentsResponse listEnvironmentsDirect() { - return listEnvironments(null, null, null, - null); + return listEnvironments(null, null, null, null); } /** * Lists environments. - * + * * @param apiVersion Which version of the API to use. * @param pageSize Optional. Maximum number of environments to return.\nIf unspecified, defaults to 50. Maximum is 1000. * @param pageToken Optional. Pagination token. @@ -133,17 +131,19 @@ public ListEnvironmentsResponse listEnvironmentsDirect() { * @throws RuntimeException subclass if the API call fails */ public ListEnvironmentsResponse listEnvironments( - @Nullable String apiVersion, @Nullable Integer pageSize, - @Nullable String pageToken, @Nullable Options options) { + @Nullable String apiVersion, + @Nullable Integer pageSize, + @Nullable String pageToken, + @Nullable Options options) { ListEnvironmentsRequest request = new ListEnvironmentsRequest(apiVersion, pageSize, pageToken); - RequestOperation operation - = new ListEnvironments.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new ListEnvironments.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Gets an environment. - * + * * @return The call builder */ public GetEnvironmentRequestBuilder getEnvironment() { @@ -152,7 +152,7 @@ public GetEnvironmentRequestBuilder getEnvironment() { /** * Gets an environment. - * + * * @param id Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. * @return The response from the API call * @throws RuntimeException subclass if the API call fails @@ -163,7 +163,7 @@ public GetEnvironmentResponse getEnvironment(@Nonnull String id) { /** * Gets an environment. - * + * * @param apiVersion Which version of the API to use. * @param id Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. * @param options additional options @@ -171,17 +171,16 @@ public GetEnvironmentResponse getEnvironment(@Nonnull String id) { * @throws RuntimeException subclass if the API call fails */ public GetEnvironmentResponse getEnvironment( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { GetEnvironmentRequest request = new GetEnvironmentRequest(apiVersion, id); - RequestOperation operation - = new GetEnvironment.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new GetEnvironment.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Deletes an environment. - * + * * @return The call builder */ public DeleteEnvironmentRequestBuilder deleteEnvironment() { @@ -190,7 +189,7 @@ public DeleteEnvironmentRequestBuilder deleteEnvironment() { /** * Deletes an environment. - * + * * @param id Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. * @return The response from the API call * @throws RuntimeException subclass if the API call fails @@ -201,7 +200,7 @@ public DeleteEnvironmentResponse deleteEnvironment(@Nonnull String id) { /** * Deletes an environment. - * + * * @param apiVersion Which version of the API to use. * @param id Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. * @param options additional options @@ -209,12 +208,10 @@ public DeleteEnvironmentResponse deleteEnvironment(@Nonnull String id) { * @throws RuntimeException subclass if the API call fails */ public DeleteEnvironmentResponse deleteEnvironment( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { DeleteEnvironmentRequest request = new DeleteEnvironmentRequest(apiVersion, id); - RequestOperation operation - = new DeleteEnvironment.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new DeleteEnvironment.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } - } diff --git a/src/main/java/com/google/genai/gaos/GenAI.java b/src/main/java/com/google/genai/gaos/GenAI.java index 01b7765d65d..a31c7956ca4 100644 --- a/src/main/java/com/google/genai/gaos/GenAI.java +++ b/src/main/java/com/google/genai/gaos/GenAI.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos; import com.google.genai.gaos.utils.HTTPClient; @@ -35,16 +34,15 @@ /** * Gemini API: The Gemini Interactions API allows developers to build generative AI applications using * Gemini models. Gemini is our most capable model, built from the ground up to be multimodal. - * + * *

It can generalize and seamlessly understand, operate across, and combine different types of * information including language, images, audio, video, and code. You can use the Gemini API for use * cases like reasoning across text and images, content generation, dialogue agents, summarization and * classification systems, and more. */ -public class GenAI { +public class GenAI implements java.lang.AutoCloseable { private static final Headers _headers = Headers.EMPTY; - /** * SERVERS contains the list of server urls available to the SDK. */ @@ -55,45 +53,37 @@ public class GenAI { "https://generativelanguage.googleapis.com", }; - private final Interactions interactions; - private final Webhooks webhooks; - private final Agents agents; - private final Triggers triggers; - private final Environments environments; - public Interactions interactions() { return interactions; } - public Webhooks webhooks() { return webhooks; } - public Agents agents() { return agents; } - public Triggers triggers() { return triggers; } - public Environments environments() { return environments; } + + private SDKConfiguration sdkConfiguration; private final AsyncGenAI asyncSDK; /** @@ -104,10 +94,8 @@ public static class Builder { private final SDKConfiguration sdkConfiguration = new SDKConfiguration(); private String serverUrl; private String server; - - private Builder() { - } + private Builder() {} /** * Allows the default HTTP client to be overridden with a custom implementation. @@ -119,7 +107,7 @@ public Builder client(HTTPClient client) { this.sdkConfiguration.setClient(client); return this; } - + /** * Configures the SDK to use the provided security details. * @@ -142,7 +130,7 @@ public Builder securitySource(SecuritySource securitySource) { this.sdkConfiguration.setSecuritySource(securitySource); return this; } - + /** * Overrides the default server URL. * @@ -165,7 +153,7 @@ public Builder serverURL(String serverUrl, Map params) { this.serverUrl = Utils.templateUrl(serverUrl, params); return this; } - + /** * Overrides the default server by index. * @@ -174,10 +162,10 @@ public Builder serverURL(String serverUrl, Map params) { */ public Builder serverIndex(int serverIdx) { this.sdkConfiguration.setServerIdx(serverIdx); - this.serverUrl= SERVERS[serverIdx]; + this.serverUrl = SERVERS[serverIdx]; return this; } - + /** * Overrides the default configuration for retries * @@ -216,7 +204,6 @@ public Builder enableHTTPDebugLogging(boolean enabled) { return this; } - /** * Allows setting the apiVersion parameter for all supported operations. * @@ -240,14 +227,14 @@ public Builder userProject(String userProject) { } // Visible for testing, may be accessed via reflection in tests Builder _hooks(com.google.genai.gaos.utils.Hooks hooks) { - sdkConfiguration.setHooks(hooks); - return this; + sdkConfiguration.setHooks(hooks); + return this; } - + // Visible for testing, may be accessed via reflection in tests Builder _hooks(Consumer consumer) { consumer.accept(sdkConfiguration.hooks()); - return this; + return this; } /** @@ -276,22 +263,32 @@ public static Builder builder() { private GenAI(SDKConfiguration sdkConfiguration) { sdkConfiguration.initialize(); + sdkConfiguration = sdkConfiguration.hooks().sdkInit(sdkConfiguration); this.interactions = new Interactions(sdkConfiguration); this.webhooks = new Webhooks(sdkConfiguration); this.agents = new Agents(sdkConfiguration); this.triggers = new Triggers(sdkConfiguration); this.environments = new Environments(sdkConfiguration); - sdkConfiguration = sdkConfiguration.hooks().sdkInit(sdkConfiguration); this.asyncSDK = new AsyncGenAI(this, sdkConfiguration); + this.sdkConfiguration = sdkConfiguration; } /** * Switches to the async SDK. - * + * * @return The async SDK */ public AsyncGenAI async() { return asyncSDK; } + /** + * Releases the configured HTTP client's owned resources. + * + * @throws Exception if the configured client cannot be closed + */ + @Override + public void close() throws Exception { + this.sdkConfiguration.closeClient(); + } } diff --git a/src/main/java/com/google/genai/gaos/Interactions.java b/src/main/java/com/google/genai/gaos/Interactions.java index e1cbd26b2fd..bfc48a10c13 100644 --- a/src/main/java/com/google/genai/gaos/Interactions.java +++ b/src/main/java/com/google/genai/gaos/Interactions.java @@ -44,7 +44,6 @@ import jakarta.annotation.Nullable; import java.lang.String; - public class Interactions { private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; @@ -57,7 +56,7 @@ public class Interactions { /** * Switches to the async SDK. - * + * * @return The async SDK */ public AsyncInteractions async() { @@ -66,9 +65,9 @@ public AsyncInteractions async() { /** * Creating an interaction - * + * *

Creates a new interaction. - * + * * @return The call builder */ public CreateInteractionRequestBuilder create() { @@ -77,9 +76,9 @@ public CreateInteractionRequestBuilder create() { /** * Creating an interaction - * + * *

Creates a new interaction. - * + * * @param body The request body. * @return The response from the API call * @throws RuntimeException subclass if the API call fails @@ -90,9 +89,9 @@ public CreateInteractionResponse create(@Nonnull CreateInteractionRequestBody bo /** * Creating an interaction - * + * *

Creates a new interaction. - * + * * @param apiVersion Which version of the API to use. * @param body The request body. * @param options additional options @@ -100,19 +99,18 @@ public CreateInteractionResponse create(@Nonnull CreateInteractionRequestBody bo * @throws RuntimeException subclass if the API call fails */ public CreateInteractionResponse create( - @Nullable String apiVersion, @Nonnull CreateInteractionRequestBody body, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull CreateInteractionRequestBody body, @Nullable Options options) { CreateInteractionRequest request = new CreateInteractionRequest(apiVersion, body); - RequestOperation operation - = new CreateInteraction.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new CreateInteraction.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Retrieving an interaction - * + * *

Retrieves the full details of a single interaction based on its `Interaction.id`. - * + * * @return The call builder */ public GetInteractionByIdRequestBuilder get() { @@ -121,9 +119,9 @@ public GetInteractionByIdRequestBuilder get() { /** * Retrieving an interaction - * + * *

Retrieves the full details of a single interaction based on its `Interaction.id`. - * + * * @param request The request object containing all the parameters for the API call. * @return The response from the API call * @throws RuntimeException subclass if the API call fails @@ -134,25 +132,25 @@ public GetInteractionByIdResponse get(@Nonnull GetInteractionByIdRequest request /** * Retrieving an interaction - * + * *

Retrieves the full details of a single interaction based on its `Interaction.id`. - * + * * @param request The request object containing all the parameters for the API call. * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ public GetInteractionByIdResponse get(@Nonnull GetInteractionByIdRequest request, @Nullable Options options) { - RequestOperation operation - = new GetInteractionById.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new GetInteractionById.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Deleting an interaction - * + * *

Deletes the interaction by id. - * + * * @return The call builder */ public DeleteInteractionRequestBuilder delete() { @@ -161,9 +159,9 @@ public DeleteInteractionRequestBuilder delete() { /** * Deleting an interaction - * + * *

Deletes the interaction by id. - * + * * @param id The unique identifier of the interaction to delete. * @return The response from the API call * @throws RuntimeException subclass if the API call fails @@ -174,9 +172,9 @@ public DeleteInteractionResponse delete(@Nonnull String id) { /** * Deleting an interaction - * + * *

Deletes the interaction by id. - * + * * @param id The unique identifier of the interaction to delete. * @param apiVersion Which version of the API to use. * @param options additional options @@ -184,19 +182,18 @@ public DeleteInteractionResponse delete(@Nonnull String id) { * @throws RuntimeException subclass if the API call fails */ public DeleteInteractionResponse delete( - @Nonnull String id, @Nullable String apiVersion, - @Nullable Options options) { + @Nonnull String id, @Nullable String apiVersion, @Nullable Options options) { DeleteInteractionRequest request = new DeleteInteractionRequest(id, apiVersion); - RequestOperation operation - = new DeleteInteraction.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new DeleteInteraction.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Canceling an interaction - * + * *

Cancels an interaction by id. This only applies to background interactions that are still running. - * + * * @return The call builder */ public CancelInteractionByIdRequestBuilder cancel() { @@ -205,9 +202,9 @@ public CancelInteractionByIdRequestBuilder cancel() { /** * Canceling an interaction - * + * *

Cancels an interaction by id. This only applies to background interactions that are still running. - * + * * @param id The unique identifier of the interaction to cancel. * @return The response from the API call * @throws RuntimeException subclass if the API call fails @@ -218,9 +215,9 @@ public CancelInteractionByIdResponse cancel(@Nonnull String id) { /** * Canceling an interaction - * + * *

Cancels an interaction by id. This only applies to background interactions that are still running. - * + * * @param id The unique identifier of the interaction to cancel. * @param apiVersion Which version of the API to use. * @param options additional options @@ -228,12 +225,10 @@ public CancelInteractionByIdResponse cancel(@Nonnull String id) { * @throws RuntimeException subclass if the API call fails */ public CancelInteractionByIdResponse cancel( - @Nonnull String id, @Nullable String apiVersion, - @Nullable Options options) { + @Nonnull String id, @Nullable String apiVersion, @Nullable Options options) { CancelInteractionByIdRequest request = new CancelInteractionByIdRequest(id, apiVersion); - RequestOperation operation - = new CancelInteractionById.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new CancelInteractionById.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } - } diff --git a/src/main/java/com/google/genai/gaos/SDKConfiguration.java b/src/main/java/com/google/genai/gaos/SDKConfiguration.java index 9ee365e02da..149a340f0be 100644 --- a/src/main/java/com/google/genai/gaos/SDKConfiguration.java +++ b/src/main/java/com/google/genai/gaos/SDKConfiguration.java @@ -30,6 +30,9 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.Optional; +// copybara:strip_begin +import java.util.concurrent.Executors; +// copybara:strip_end import java.util.concurrent.ScheduledExecutorService; public class SDKConfiguration { @@ -37,77 +40,85 @@ public class SDKConfiguration { private static final String LANGUAGE = "java"; public static final String OPENAPI_DOC_VERSION = "v1beta"; public static final String SDK_VERSION = "0.1.0"; - public static final String GEN_VERSION = "2.924.0"; + public static final String GEN_VERSION = "2.931.0"; private static final String BASE_PACKAGE = "com.google.genai.gaos"; - public static final String USER_AGENT = - String.format("speakeasy-sdk/%s %s %s %s %s", - LANGUAGE, SDK_VERSION, GEN_VERSION, OPENAPI_DOC_VERSION, BASE_PACKAGE); + public static final String USER_AGENT = String.format( + "speakeasy-sdk/%s %s %s %s %s", LANGUAGE, SDK_VERSION, GEN_VERSION, OPENAPI_DOC_VERSION, BASE_PACKAGE); private SecuritySource securitySource = SecuritySource.of(null); - + public SecuritySource securitySource() { return securitySource; } - + public void setSecuritySource(SecuritySource securitySource) { Utils.checkNotNull(securitySource, "securitySource"); this.securitySource = securitySource; } - + private HTTPClient client = new SpeakeasyHTTPClient(); - + public HTTPClient client() { return client; } - + public void setClient(HTTPClient client) { Utils.checkNotNull(client, "client"); this.client = client; } - + + private final java.util.concurrent.atomic.AtomicReference closedClient = + new java.util.concurrent.atomic.AtomicReference<>(); + + public void closeClient() throws Exception { + Object client = client(); + if (closedClient.getAndSet(client) != client && client instanceof java.lang.AutoCloseable) { + ((java.lang.AutoCloseable) client).close(); + } + } + private String serverUrl; - + public String serverUrl() { return serverUrl; } - + public void setServerUrl(String serverUrl) { Utils.checkNotNull(serverUrl, "serverUrl"); this.serverUrl = trimFinalSlash(serverUrl); } - + private static String trimFinalSlash(String url) { if (url == null) { return null; } else if (url.endsWith("/")) { return url.substring(0, url.length() - 1); - } else { + } else { return url; } } - + public String resolvedServerUrl() { return serverUrl; } - + private int serverIdx = 0; - + public void setServerIdx(int serverIdx) { this.serverIdx = serverIdx; } - + public int serverIdx() { return serverIdx; } - - + private Hooks _hooks = createHooks(); private static Hooks createHooks() { Hooks hooks = new Hooks(); return hooks; } - + public Hooks hooks() { return _hooks; } @@ -126,9 +137,9 @@ public void initialize() { @SuppressWarnings("serial") public Globals globals = new Globals(); - + private Optional retryConfig = Optional.empty(); - + public Optional retryConfig() { return retryConfig; } @@ -137,9 +148,20 @@ public void setRetryConfig(Optional retryConfig) { Utils.checkNotNull(retryConfig, "retryConfig"); this.retryConfig = retryConfig; } - private ScheduledExecutorService retryScheduler = java.util.concurrent.Executors.newSingleThreadScheduledExecutor(); - + + private ScheduledExecutorService retryScheduler + // copybara:strip_begin + = Executors.newSingleThreadScheduledExecutor() + // copybara:strip_end + ; + public ScheduledExecutorService retryScheduler() { + if (retryScheduler == null) { + throw new IllegalStateException( + "asyncRetryScheduler is required in google3 to avoid disallowed thread creation. " + + "Please provide a managed ScheduledExecutorService via " + + "Client.Builder.asyncRetryScheduler()."); + } return retryScheduler; } diff --git a/src/main/java/com/google/genai/gaos/SecuritySource.java b/src/main/java/com/google/genai/gaos/SecuritySource.java index f57b44f5637..5852e788e8e 100644 --- a/src/main/java/com/google/genai/gaos/SecuritySource.java +++ b/src/main/java/com/google/genai/gaos/SecuritySource.java @@ -24,7 +24,7 @@ public interface SecuritySource { HasSecurity getSecurity(); - + public static SecuritySource of(HasSecurity security) { return new DefaultSecuritySource(security); } diff --git a/src/main/java/com/google/genai/gaos/Triggers.java b/src/main/java/com/google/genai/gaos/Triggers.java index a40dbffa311..ef639e03972 100644 --- a/src/main/java/com/google/genai/gaos/Triggers.java +++ b/src/main/java/com/google/genai/gaos/Triggers.java @@ -58,7 +58,6 @@ import java.lang.Long; import java.lang.String; - public class Triggers { private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; @@ -71,7 +70,7 @@ public class Triggers { /** * Switches to the async SDK. - * + * * @return The async SDK */ public AsyncTriggers async() { @@ -80,7 +79,7 @@ public AsyncTriggers async() { /** * Creates a new trigger that will invoke the specified agent on the given cron schedule. - * + * * @return The call builder */ public CreateTriggerRequestBuilder create() { @@ -89,7 +88,7 @@ public CreateTriggerRequestBuilder create() { /** * Creates a new trigger that will invoke the specified agent on the given cron schedule. - * + * * @param body Parameters for creating a trigger. * @return The response from the API call * @throws RuntimeException subclass if the API call fails @@ -100,7 +99,7 @@ public CreateTriggerResponse create(@Nonnull TriggerCreateParams body) { /** * Creates a new trigger that will invoke the specified agent on the given cron schedule. - * + * * @param apiVersion Which version of the API to use. * @param body Parameters for creating a trigger. * @param options additional options @@ -108,17 +107,16 @@ public CreateTriggerResponse create(@Nonnull TriggerCreateParams body) { * @throws RuntimeException subclass if the API call fails */ public CreateTriggerResponse create( - @Nullable String apiVersion, @Nonnull TriggerCreateParams body, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull TriggerCreateParams body, @Nullable Options options) { CreateTriggerRequest request = new CreateTriggerRequest(apiVersion, body); - RequestOperation operation - = new CreateTrigger.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new CreateTrigger.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Lists triggers for a project. - * + * * @return The call builder */ public ListTriggersRequestBuilder list() { @@ -127,18 +125,17 @@ public ListTriggersRequestBuilder list() { /** * Lists triggers for a project. - * + * * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ public ListTriggersResponse listDirect() { - return list(null, null, null, - null, null); + return list(null, null, null, null, null); } /** * Lists triggers for a project. - * + * * @param apiVersion Which version of the API to use. * @param filter Optional. Filter expression (e.g., by state). * @param pageSize Optional. The maximum number of triggers to return per page. @@ -148,20 +145,20 @@ public ListTriggersResponse listDirect() { * @throws RuntimeException subclass if the API call fails */ public ListTriggersResponse list( - @Nullable String apiVersion, @Nullable String filter, - @Nullable Long pageSize, @Nullable String pageToken, + @Nullable String apiVersion, + @Nullable String filter, + @Nullable Long pageSize, + @Nullable String pageToken, @Nullable Options options) { - ListTriggersRequest request = new ListTriggersRequest( - apiVersion, filter, pageSize, - pageToken); - RequestOperation operation - = new ListTriggers.Sync(sdkConfiguration, options, _headers); + ListTriggersRequest request = new ListTriggersRequest(apiVersion, filter, pageSize, pageToken); + RequestOperation operation = + new ListTriggers.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Gets details of a single trigger. - * + * * @return The call builder */ public GetTriggerRequestBuilder get() { @@ -170,7 +167,7 @@ public GetTriggerRequestBuilder get() { /** * Gets details of a single trigger. - * + * * @param id Resource name of the trigger. * @return The response from the API call * @throws RuntimeException subclass if the API call fails @@ -181,25 +178,23 @@ public GetTriggerResponse get(@Nonnull String id) { /** * Gets details of a single trigger. - * + * * @param apiVersion Which version of the API to use. * @param id Resource name of the trigger. * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public GetTriggerResponse get( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { + public GetTriggerResponse get(@Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { GetTriggerRequest request = new GetTriggerRequest(apiVersion, id); - RequestOperation operation - = new GetTrigger.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new GetTrigger.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Updates a trigger. - * + * * @return The call builder */ public UpdateTriggerRequestBuilder update() { @@ -208,20 +203,19 @@ public UpdateTriggerRequestBuilder update() { /** * Updates a trigger. - * + * * @param id Resource name of the trigger. * @param body Represents the fields of a Trigger that can be updated. * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ public UpdateTriggerResponse update(@Nonnull String id, @Nonnull TriggerUpdate body) { - return update(null, id, body, - null); + return update(null, id, body, null); } /** * Updates a trigger. - * + * * @param apiVersion Which version of the API to use. * @param id Resource name of the trigger. * @param body Represents the fields of a Trigger that can be updated. @@ -230,17 +224,16 @@ public UpdateTriggerResponse update(@Nonnull String id, @Nonnull TriggerUpdate b * @throws RuntimeException subclass if the API call fails */ public UpdateTriggerResponse update( - @Nullable String apiVersion, @Nonnull String id, - @Nonnull TriggerUpdate body, @Nullable Options options) { + @Nullable String apiVersion, @Nonnull String id, @Nonnull TriggerUpdate body, @Nullable Options options) { UpdateTriggerRequest request = new UpdateTriggerRequest(apiVersion, id, body); - RequestOperation operation - = new UpdateTrigger.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new UpdateTrigger.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Deletes a trigger. - * + * * @return The call builder */ public DeleteTriggerRequestBuilder delete() { @@ -249,7 +242,7 @@ public DeleteTriggerRequestBuilder delete() { /** * Deletes a trigger. - * + * * @param id Resource name of the trigger. * @return The response from the API call * @throws RuntimeException subclass if the API call fails @@ -260,25 +253,23 @@ public DeleteTriggerResponse delete(@Nonnull String id) { /** * Deletes a trigger. - * + * * @param apiVersion Which version of the API to use. * @param id Resource name of the trigger. * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public DeleteTriggerResponse delete( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { + public DeleteTriggerResponse delete(@Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { DeleteTriggerRequest request = new DeleteTriggerRequest(apiVersion, id); - RequestOperation operation - = new DeleteTrigger.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new DeleteTrigger.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Runs a trigger immediately. - * + * * @return The call builder */ public RunTriggerRequestBuilder run() { @@ -287,7 +278,7 @@ public RunTriggerRequestBuilder run() { /** * Runs a trigger immediately. - * + * * @param triggerId Resource name of the trigger. * @return The response from the API call * @throws RuntimeException subclass if the API call fails @@ -298,25 +289,23 @@ public RunTriggerResponse run(@Nonnull String triggerId) { /** * Runs a trigger immediately. - * + * * @param apiVersion Which version of the API to use. * @param triggerId Resource name of the trigger. * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public RunTriggerResponse run( - @Nullable String apiVersion, @Nonnull String triggerId, - @Nullable Options options) { + public RunTriggerResponse run(@Nullable String apiVersion, @Nonnull String triggerId, @Nullable Options options) { RunTriggerRequest request = new RunTriggerRequest(apiVersion, triggerId); - RequestOperation operation - = new RunTrigger.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new RunTrigger.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Lists executions for a trigger. - * + * * @return The call builder */ public ListTriggerExecutionsRequestBuilder listExecutions() { @@ -325,19 +314,18 @@ public ListTriggerExecutionsRequestBuilder listExecutions() { /** * Lists executions for a trigger. - * + * * @param triggerId Resource name of the trigger. * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ public ListTriggerExecutionsResponse listExecutions(@Nonnull String triggerId) { - return listExecutions(null, triggerId, null, - null, null); + return listExecutions(null, triggerId, null, null, null); } /** * Lists executions for a trigger. - * + * * @param apiVersion Which version of the API to use. * @param triggerId Resource name of the trigger. * @param pageSize Optional. The maximum number of executions to return per page. @@ -347,15 +335,15 @@ public ListTriggerExecutionsResponse listExecutions(@Nonnull String triggerId) { * @throws RuntimeException subclass if the API call fails */ public ListTriggerExecutionsResponse listExecutions( - @Nullable String apiVersion, @Nonnull String triggerId, - @Nullable Long pageSize, @Nullable String pageToken, + @Nullable String apiVersion, + @Nonnull String triggerId, + @Nullable Long pageSize, + @Nullable String pageToken, @Nullable Options options) { - ListTriggerExecutionsRequest request = new ListTriggerExecutionsRequest( - apiVersion, triggerId, pageSize, - pageToken); - RequestOperation operation - = new ListTriggerExecutions.Sync(sdkConfiguration, options, _headers); + ListTriggerExecutionsRequest request = + new ListTriggerExecutionsRequest(apiVersion, triggerId, pageSize, pageToken); + RequestOperation operation = + new ListTriggerExecutions.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } - } diff --git a/src/main/java/com/google/genai/gaos/Webhooks.java b/src/main/java/com/google/genai/gaos/Webhooks.java index ba88b0afa21..9e696521984 100644 --- a/src/main/java/com/google/genai/gaos/Webhooks.java +++ b/src/main/java/com/google/genai/gaos/Webhooks.java @@ -58,7 +58,6 @@ import java.lang.Integer; import java.lang.String; - public class Webhooks { private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; @@ -71,7 +70,7 @@ public class Webhooks { /** * Switches to the async SDK. - * + * * @return The async SDK */ public AsyncWebhooks async() { @@ -80,7 +79,7 @@ public AsyncWebhooks async() { /** * Creates a new Webhook. - * + * * @return The call builder */ public CreateWebhookRequestBuilder create() { @@ -89,7 +88,7 @@ public CreateWebhookRequestBuilder create() { /** * Creates a new Webhook. - * + * * @param body A Webhook resource. * @return The response from the API call * @throws RuntimeException subclass if the API call fails @@ -100,7 +99,7 @@ public CreateWebhookResponse create(@Nonnull WebhookInput body) { /** * Creates a new Webhook. - * + * * @param apiVersion Which version of the API to use. * @param body A Webhook resource. * @param options additional options @@ -108,17 +107,16 @@ public CreateWebhookResponse create(@Nonnull WebhookInput body) { * @throws RuntimeException subclass if the API call fails */ public CreateWebhookResponse create( - @Nullable String apiVersion, @Nonnull WebhookInput body, - @Nullable Options options) { + @Nullable String apiVersion, @Nonnull WebhookInput body, @Nullable Options options) { CreateWebhookRequest request = new CreateWebhookRequest(apiVersion, body); - RequestOperation operation - = new CreateWebhook.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new CreateWebhook.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Lists all Webhooks. - * + * * @return The call builder */ public ListWebhooksRequestBuilder list() { @@ -127,18 +125,17 @@ public ListWebhooksRequestBuilder list() { /** * Lists all Webhooks. - * + * * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ public ListWebhooksResponse listDirect() { - return list(null, null, null, - null); + return list(null, null, null, null); } /** * Lists all Webhooks. - * + * * @param apiVersion Which version of the API to use. * @param pageSize Optional. The maximum number of webhooks to return. The service may return fewer than * this value. If unspecified, at most 50 webhooks will be returned. @@ -150,17 +147,19 @@ public ListWebhooksResponse listDirect() { * @throws RuntimeException subclass if the API call fails */ public ListWebhooksResponse list( - @Nullable String apiVersion, @Nullable Integer pageSize, - @Nullable String pageToken, @Nullable Options options) { + @Nullable String apiVersion, + @Nullable Integer pageSize, + @Nullable String pageToken, + @Nullable Options options) { ListWebhooksRequest request = new ListWebhooksRequest(apiVersion, pageSize, pageToken); - RequestOperation operation - = new ListWebhooks.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new ListWebhooks.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Gets a specific Webhook. - * + * * @return The call builder */ public GetWebhookRequestBuilder get() { @@ -169,7 +168,7 @@ public GetWebhookRequestBuilder get() { /** * Gets a specific Webhook. - * + * * @param id Required. The ID of the webhook to retrieve. * @return The response from the API call * @throws RuntimeException subclass if the API call fails @@ -180,25 +179,23 @@ public GetWebhookResponse get(@Nonnull String id) { /** * Gets a specific Webhook. - * + * * @param apiVersion Which version of the API to use. * @param id Required. The ID of the webhook to retrieve. * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public GetWebhookResponse get( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { + public GetWebhookResponse get(@Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { GetWebhookRequest request = new GetWebhookRequest(apiVersion, id); - RequestOperation operation - = new GetWebhook.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new GetWebhook.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Updates an existing Webhook. - * + * * @return The call builder */ public UpdateWebhookRequestBuilder update() { @@ -207,42 +204,41 @@ public UpdateWebhookRequestBuilder update() { /** * Updates an existing Webhook. - * + * * @param id Required. The ID of the webhook to update. * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ public UpdateWebhookResponse update(@Nonnull String id) { - return update(null, id, null, - null, null); + return update(null, id, null, null, null); } /** * Updates an existing Webhook. - * + * * @param apiVersion Which version of the API to use. * @param id Required. The ID of the webhook to update. * @param updateMask Optional. The list of fields to update. - * @param body + * @param body * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ public UpdateWebhookResponse update( - @Nullable String apiVersion, @Nonnull String id, - @Nullable String updateMask, @Nullable WebhookUpdate body, + @Nullable String apiVersion, + @Nonnull String id, + @Nullable String updateMask, + @Nullable WebhookUpdate body, @Nullable Options options) { - UpdateWebhookRequest request = new UpdateWebhookRequest( - apiVersion, id, updateMask, - body); - RequestOperation operation - = new UpdateWebhook.Sync(sdkConfiguration, options, _headers); + UpdateWebhookRequest request = new UpdateWebhookRequest(apiVersion, id, updateMask, body); + RequestOperation operation = + new UpdateWebhook.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Deletes a Webhook. - * + * * @return The call builder */ public DeleteWebhookRequestBuilder delete() { @@ -251,7 +247,7 @@ public DeleteWebhookRequestBuilder delete() { /** * Deletes a Webhook. - * + * * @param id Required. The ID of the webhook to delete. * Format: `{webhook_id}` * @return The response from the API call @@ -263,7 +259,7 @@ public DeleteWebhookResponse delete(@Nonnull String id) { /** * Deletes a Webhook. - * + * * @param apiVersion Which version of the API to use. * @param id Required. The ID of the webhook to delete. * Format: `{webhook_id}` @@ -271,18 +267,16 @@ public DeleteWebhookResponse delete(@Nonnull String id) { * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public DeleteWebhookResponse delete( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { + public DeleteWebhookResponse delete(@Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { DeleteWebhookRequest request = new DeleteWebhookRequest(apiVersion, id); - RequestOperation operation - = new DeleteWebhook.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new DeleteWebhook.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Generates a new signing secret for a Webhook. - * + * * @return The call builder */ public RotateSigningSecretRequestBuilder rotateSigningSecret() { @@ -291,20 +285,19 @@ public RotateSigningSecretRequestBuilder rotateSigningSecret() { /** * Generates a new signing secret for a Webhook. - * + * * @param id Required. The ID of the webhook for which to generate a signing secret. * Format: `{webhook_id}` * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ public RotateSigningSecretResponse rotateSigningSecret(@Nonnull String id) { - return rotateSigningSecret(null, id, null, - null); + return rotateSigningSecret(null, id, null, null); } /** * Generates a new signing secret for a Webhook. - * + * * @param apiVersion Which version of the API to use. * @param id Required. The ID of the webhook for which to generate a signing secret. * Format: `{webhook_id}` @@ -314,17 +307,20 @@ public RotateSigningSecretResponse rotateSigningSecret(@Nonnull String id) { * @throws RuntimeException subclass if the API call fails */ public RotateSigningSecretResponse rotateSigningSecret( - @Nullable String apiVersion, @Nonnull String id, - @Nullable RotateSigningSecretRequest body, @Nullable Options options) { - com.google.genai.gaos.models.operations.RotateSigningSecretRequest request = new com.google.genai.gaos.models.operations.RotateSigningSecretRequest(apiVersion, id, body); - RequestOperation operation - = new RotateSigningSecret.Sync(sdkConfiguration, options, _headers); + @Nullable String apiVersion, + @Nonnull String id, + @Nullable RotateSigningSecretRequest body, + @Nullable Options options) { + com.google.genai.gaos.models.operations.RotateSigningSecretRequest request = + new com.google.genai.gaos.models.operations.RotateSigningSecretRequest(apiVersion, id, body); + RequestOperation operation = + new RotateSigningSecret.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** * Sends a ping event to a Webhook. - * + * * @return The call builder */ public PingWebhookRequestBuilder ping() { @@ -333,20 +329,19 @@ public PingWebhookRequestBuilder ping() { /** * Sends a ping event to a Webhook. - * + * * @param id Required. The ID of the webhook to ping. * Format: `{webhook_id}` * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ public PingWebhookResponse ping(@Nonnull String id) { - return ping(null, id, null, - null); + return ping(null, id, null, null); } /** * Sends a ping event to a Webhook. - * + * * @param apiVersion Which version of the API to use. * @param id Required. The ID of the webhook to ping. * Format: `{webhook_id}` @@ -356,12 +351,14 @@ public PingWebhookResponse ping(@Nonnull String id) { * @throws RuntimeException subclass if the API call fails */ public PingWebhookResponse ping( - @Nullable String apiVersion, @Nonnull String id, - @Nullable PingWebhookRequest body, @Nullable Options options) { - com.google.genai.gaos.models.operations.PingWebhookRequest request = new com.google.genai.gaos.models.operations.PingWebhookRequest(apiVersion, id, body); - RequestOperation operation - = new PingWebhook.Sync(sdkConfiguration, options, _headers); + @Nullable String apiVersion, + @Nonnull String id, + @Nullable PingWebhookRequest body, + @Nullable Options options) { + com.google.genai.gaos.models.operations.PingWebhookRequest request = + new com.google.genai.gaos.models.operations.PingWebhookRequest(apiVersion, id, body); + RequestOperation operation = + new PingWebhook.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } - } diff --git a/src/main/java/com/google/genai/gaos/hooks/SDKHooks.java b/src/main/java/com/google/genai/gaos/hooks/SDKHooks.java index 2e8be322ec3..eefedb9a150 100644 --- a/src/main/java/com/google/genai/gaos/hooks/SDKHooks.java +++ b/src/main/java/com/google/genai/gaos/hooks/SDKHooks.java @@ -16,17 +16,9 @@ package com.google.genai.gaos.hooks; -import com.google.genai.gaos.models.shared.Security; -import com.google.genai.gaos.utils.HasSecurity; -import com.google.genai.gaos.utils.transport.HttpRequest; -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -// // This file is written once by speakeasy code generation and // thereafter will not be overwritten by speakeasy updates. As a // consequence any customization of this class will be preserved. -// public final class SDKHooks { @@ -35,55 +27,29 @@ private SDKHooks() { } public static void initialize(com.google.genai.gaos.utils.Hooks hooks) { - hooks.registerBeforeRequest( - (context, request) -> { - if (context.securitySource().isPresent()) { - HasSecurity hasSecurity = context.securitySource().get().getSecurity(); - if (hasSecurity instanceof Security) { - Security security = (Security) hasSecurity; - HttpRequest.Builder builder = request.toBuilder(); + // register synchronous hooks here + // hooks.registerBeforeRequest(...); + // hooks.registerAfterSuccess(...); + // hooks.registerAfterError(...); - if (security.defaultHeaders().isPresent()) { - for (Map.Entry entry : security.defaultHeaders().get().entrySet()) { - builder.setHeader(entry.getKey(), entry.getValue()); - } - } - if (security.apiKey().isPresent()) { - builder.setHeader("x-goog-api-key", security.apiKey().get()); - } else if (security.accessToken().isPresent()) { - builder.setHeader("Authorization", "Bearer " + security.accessToken().get()); - } - return builder.build(); - } - } - return request; - }); + // for more information see + // https://www.speakeasy.com/docs/additional-features/sdk-hooks } public static void initialize(com.google.genai.gaos.utils.AsyncHooks asyncHooks) { - asyncHooks.registerBeforeRequest( - (context, request) -> { - if (context.securitySource().isPresent()) { - HasSecurity hasSecurity = context.securitySource().get().getSecurity(); - if (hasSecurity instanceof Security) { - Security security = (Security) hasSecurity; - HttpRequest.Builder builder = request.toBuilder(); + // register async hooks here + // asyncHooks.registerBeforeRequest(...); + // asyncHooks.registerAfterSuccess(...); + // asyncHooks.registerAfterError(...); - if (security.defaultHeaders().isPresent()) { - for (Map.Entry entry : security.defaultHeaders().get().entrySet()) { - builder.setHeader(entry.getKey(), entry.getValue()); - } - } - if (security.apiKey().isPresent()) { - builder.setHeader("x-goog-api-key", security.apiKey().get()); - } else if (security.accessToken().isPresent()) { - builder.setHeader("Authorization", "Bearer " + security.accessToken().get()); - } - return CompletableFuture.completedFuture(builder.build()); - } - } - return CompletableFuture.completedFuture(request); - }); - } + // NOTE: If you have existing synchronous hooks, you can adapt them using HookAdapters: + // asyncHooks.registerAfterError(com.google.genai.gaos.utils.HookAdapters.adapt(mySyncHook)); + // PERFORMANCE TIP: For better performance, implement async hooks directly using + // non-blocking I/O (NIO) APIs instead of adapting synchronous hooks, as adapters + // offload execution to the ForkJoinPool which can introduce overhead. + + // for more information see + // https://www.speakeasy.com/docs/additional-features/sdk-hooks + } } diff --git a/src/main/java/com/google/genai/gaos/models/agents/Agent.java b/src/main/java/com/google/genai/gaos/models/agents/Agent.java index ec811ee67e5..8fa8bb13d0a 100644 --- a/src/main/java/com/google/genai/gaos/models/agents/Agent.java +++ b/src/main/java/com/google/genai/gaos/models/agents/Agent.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.agents; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * Agent - * + * *

An agent definition for the CreateAgent API. * This message is the target for annotation-parser-based JSON parsing. * New format: @@ -111,11 +111,9 @@ public Agent( this.systemInstruction = systemInstruction; this.tools = tools; } - + public Agent() { - this(null, null, null, - null, null, null, - null); + this(null, null, null, null, null, null, null); } /** @@ -171,7 +169,6 @@ public static Builder builder() { return new Builder(); } - /** * Configuration parameters for the agent. */ @@ -180,7 +177,6 @@ public Agent withAgentConfig(@Nullable AgentConfig agentConfig) { return this; } - /** * The base agent to extend. */ @@ -189,7 +185,6 @@ public Agent withBaseAgent(@Nullable String baseAgent) { return this; } - /** * The environment configuration for the agent. */ @@ -198,7 +193,6 @@ public Agent withBaseEnvironment(@Nullable BaseEnvironment baseEnvironment) { return this; } - /** * Agent description for developers to quickly read and understand. */ @@ -207,7 +201,6 @@ public Agent withDescription(@Nullable String description) { return this; } - /** * The unique identifier for the agent. */ @@ -216,7 +209,6 @@ public Agent withId(@Nullable String id) { return this; } - /** * System instruction for the agent. */ @@ -225,7 +217,6 @@ public Agent withSystemInstruction(@Nullable String systemInstruction) { return this; } - /** * The tools available to the agent. */ @@ -234,7 +225,6 @@ public Agent withTools(@Nullable List tools) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -244,38 +234,42 @@ public boolean equals(java.lang.Object o) { return false; } Agent other = (Agent) o; - return - Utils.enhancedDeepEquals(this.agentConfig, other.agentConfig) && - Utils.enhancedDeepEquals(this.baseAgent, other.baseAgent) && - Utils.enhancedDeepEquals(this.baseEnvironment, other.baseEnvironment) && - Utils.enhancedDeepEquals(this.description, other.description) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.systemInstruction, other.systemInstruction) && - Utils.enhancedDeepEquals(this.tools, other.tools); + return Utils.enhancedDeepEquals(this.agentConfig, other.agentConfig) + && Utils.enhancedDeepEquals(this.baseAgent, other.baseAgent) + && Utils.enhancedDeepEquals(this.baseEnvironment, other.baseEnvironment) + && Utils.enhancedDeepEquals(this.description, other.description) + && Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.systemInstruction, other.systemInstruction) + && Utils.enhancedDeepEquals(this.tools, other.tools); } - + @Override public int hashCode() { - return Utils.enhancedHash( - agentConfig, baseAgent, baseEnvironment, - description, id, systemInstruction, - tools); + return Utils.enhancedHash(agentConfig, baseAgent, baseEnvironment, description, id, systemInstruction, tools); } - + @Override public String toString() { - return Utils.toString(Agent.class, - "agentConfig", agentConfig, - "baseAgent", baseAgent, - "baseEnvironment", baseEnvironment, - "description", description, - "id", id, - "systemInstruction", systemInstruction, - "tools", tools); + return Utils.toString( + Agent.class, + "agentConfig", + agentConfig, + "baseAgent", + baseAgent, + "baseEnvironment", + baseEnvironment, + "description", + description, + "id", + id, + "systemInstruction", + systemInstruction, + "tools", + tools); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private AgentConfig agentConfig; @@ -292,7 +286,7 @@ public final static class Builder { private List tools; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -352,11 +346,7 @@ public Builder tools(@Nullable List tools) { } public Agent build() { - return new Agent( - agentConfig, baseAgent, baseEnvironment, - description, id, systemInstruction, - tools); + return new Agent(agentConfig, baseAgent, baseEnvironment, description, id, systemInstruction, tools); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/agents/AgentConfig.java b/src/main/java/com/google/genai/gaos/models/agents/AgentConfig.java index 93f69d3b70f..a9153c25945 100644 --- a/src/main/java/com/google/genai/gaos/models/agents/AgentConfig.java +++ b/src/main/java/com/google/genai/gaos/models/agents/AgentConfig.java @@ -26,9 +26,9 @@ import com.google.genai.gaos.models.interactions.AntigravityAgentConfig; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -36,7 +36,7 @@ /** * AgentConfig - * + * *

Configuration parameters for the agent. */ @JsonDeserialize(using = AgentConfig._Deserializer.class) @@ -44,16 +44,16 @@ public class AgentConfig { @JsonValue private final TypedObject value; - + private AgentConfig(TypedObject value) { this.value = value; } public static AgentConfig of(AntigravityAgentConfig value) { Utils.checkNotNull(value, "value"); - return new AgentConfig(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new AgentConfig(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code AntigravityAgentConfig}, * otherwise returns an empty {@link Optional}. @@ -66,19 +66,19 @@ public Optional antigravityAgentConfig() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -90,26 +90,25 @@ public boolean equals(java.lang.Object o) { AgentConfig other = (AgentConfig) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(AgentConfig.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + AgentConfig.class, + false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(AgentConfig.class, - "value", value); + return Utils.toString(AgentConfig.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/agents/AgentListResponse.java b/src/main/java/com/google/genai/gaos/models/agents/AgentListResponse.java index de078c36e77..f968f30e9bd 100644 --- a/src/main/java/com/google/genai/gaos/models/agents/AgentListResponse.java +++ b/src/main/java/com/google/genai/gaos/models/agents/AgentListResponse.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.agents; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -30,14 +30,12 @@ import java.util.List; import java.util.Optional; - public class AgentListResponse { @JsonInclude(Include.NON_ABSENT) @JsonProperty("agents") private List agents; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("next_page_token") private String nextPageToken; @@ -49,7 +47,7 @@ public AgentListResponse( this.agents = agents; this.nextPageToken = nextPageToken; } - + public AgentListResponse() { this(null, null); } @@ -66,19 +64,16 @@ public static Builder builder() { return new Builder(); } - public AgentListResponse withAgents(@Nullable List agents) { this.agents = agents; return this; } - public AgentListResponse withNextPageToken(@Nullable String nextPageToken) { this.nextPageToken = nextPageToken; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -88,33 +83,29 @@ public boolean equals(java.lang.Object o) { return false; } AgentListResponse other = (AgentListResponse) o; - return - Utils.enhancedDeepEquals(this.agents, other.agents) && - Utils.enhancedDeepEquals(this.nextPageToken, other.nextPageToken); + return Utils.enhancedDeepEquals(this.agents, other.agents) + && Utils.enhancedDeepEquals(this.nextPageToken, other.nextPageToken); } - + @Override public int hashCode() { - return Utils.enhancedHash( - agents, nextPageToken); + return Utils.enhancedHash(agents, nextPageToken); } - + @Override public String toString() { - return Utils.toString(AgentListResponse.class, - "agents", agents, - "nextPageToken", nextPageToken); + return Utils.toString(AgentListResponse.class, "agents", agents, "nextPageToken", nextPageToken); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List agents; private String nextPageToken; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder agents(@Nullable List agents) { @@ -128,9 +119,7 @@ public Builder nextPageToken(@Nullable String nextPageToken) { } public AgentListResponse build() { - return new AgentListResponse( - agents, nextPageToken); + return new AgentListResponse(agents, nextPageToken); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/agents/AgentTool.java b/src/main/java/com/google/genai/gaos/models/agents/AgentTool.java index a0dae5adb9a..cd2ffa392e8 100644 --- a/src/main/java/com/google/genai/gaos/models/agents/AgentTool.java +++ b/src/main/java/com/google/genai/gaos/models/agents/AgentTool.java @@ -19,15 +19,15 @@ */ package com.google.genai.gaos.models.agents; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; -import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver; import java.lang.String; /** * AgentTool - * + * *

A tool that the agent can use. */ @JsonTypeInfo( @@ -35,12 +35,9 @@ property = "type", include = As.EXISTING_PROPERTY, visible = true, - defaultImpl = UnknownAgentTool.class -) + defaultImpl = UnknownAgentTool.class) @JsonTypeIdResolver(AgentToolTypeIdResolver.class) public interface AgentTool { String type(); - } - diff --git a/src/main/java/com/google/genai/gaos/models/agents/AgentToolTypeIdResolver.java b/src/main/java/com/google/genai/gaos/models/agents/AgentToolTypeIdResolver.java index 7d3b4df6a27..2a8212b7a0b 100644 --- a/src/main/java/com/google/genai/gaos/models/agents/AgentToolTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/models/agents/AgentToolTypeIdResolver.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.agents; import com.google.genai.gaos.models.interactions.CodeExecution; @@ -31,10 +30,9 @@ import java.lang.Override; import java.lang.String; - /** * AgentToolTypeIdResolver - * + * *

A tool that the agent can use. */ public class AgentToolTypeIdResolver extends GenericTypeIdResolver { @@ -57,19 +55,19 @@ public String idFromValue(Object value) { if (value == null) { return null; } - + // Handle known types by checking if they implement the discriminator method if (value instanceof AgentTool) { AgentTool discriminated = (AgentTool) value; return discriminated.type(); } - - throw new IllegalArgumentException("Unknown value type: " + value.getClass().getName()); + + throw new IllegalArgumentException( + "Unknown value type: " + value.getClass().getName()); } @Override public String getDescForKnownTypeIds() { return "AgentTool type resolver"; } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/agents/BaseEnvironment.java b/src/main/java/com/google/genai/gaos/models/agents/BaseEnvironment.java index 2186d198eb1..f6aff8a004e 100644 --- a/src/main/java/com/google/genai/gaos/models/agents/BaseEnvironment.java +++ b/src/main/java/com/google/genai/gaos/models/agents/BaseEnvironment.java @@ -26,9 +26,9 @@ import com.google.genai.gaos.models.interactions.Environment; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -36,7 +36,7 @@ /** * BaseEnvironment - * + * *

The environment configuration for the agent. */ @JsonDeserialize(using = BaseEnvironment._Deserializer.class) @@ -44,21 +44,21 @@ public class BaseEnvironment { @JsonValue private final TypedObject value; - + private BaseEnvironment(TypedObject value) { this.value = value; } public static BaseEnvironment of(Environment value) { Utils.checkNotNull(value, "value"); - return new BaseEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new BaseEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static BaseEnvironment of(String value) { Utils.checkNotNull(value, "value"); - return new BaseEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new BaseEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code Environment}, * otherwise returns an empty {@link Optional}. @@ -71,7 +71,7 @@ public Optional environment() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code String}, * otherwise returns an empty {@link Optional}. @@ -84,19 +84,19 @@ public Optional string() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -108,27 +108,26 @@ public boolean equals(java.lang.Object o) { BaseEnvironment other = (BaseEnvironment) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(BaseEnvironment.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + BaseEnvironment.class, + false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(BaseEnvironment.class, - "value", value); + return Utils.toString(BaseEnvironment.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/agents/UnknownAgentTool.java b/src/main/java/com/google/genai/gaos/models/agents/UnknownAgentTool.java index 32982eb3e28..fa081d3f31c 100644 --- a/src/main/java/com/google/genai/gaos/models/agents/UnknownAgentTool.java +++ b/src/main/java/com/google/genai/gaos/models/agents/UnknownAgentTool.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.agents; import com.fasterxml.jackson.annotation.JsonCreator; @@ -26,10 +25,9 @@ import java.lang.Override; import java.lang.String; - /** * UnknownAgentTool - * + * *

A tool that the agent can use. */ public class UnknownAgentTool extends UnknownType implements AgentTool { @@ -43,5 +41,4 @@ public UnknownAgentTool(JsonNode rawNode) { public String type() { return extractDiscriminator("type").orElse("UNKNOWN"); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/environments/CreateEnvironmentRequest.java b/src/main/java/com/google/genai/gaos/models/environments/CreateEnvironmentRequest.java index 8c267ec599a..eca615ea3f7 100644 --- a/src/main/java/com/google/genai/gaos/models/environments/CreateEnvironmentRequest.java +++ b/src/main/java/com/google/genai/gaos/models/environments/CreateEnvironmentRequest.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.environments; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.models.interactions.Source; import com.google.genai.gaos.utils.Utils; @@ -33,7 +33,7 @@ /** * CreateEnvironmentRequest - * + * *

Request for `CreateEnvironment`. */ public class CreateEnvironmentRequest { @@ -58,7 +58,7 @@ public CreateEnvironmentRequest( this.network = network; this.sources = sources; } - + public CreateEnvironmentRequest() { this(null, null); } @@ -81,7 +81,6 @@ public static Builder builder() { return new Builder(); } - /** * Network configuration for the environment. */ @@ -90,7 +89,6 @@ public CreateEnvironmentRequest withNetwork(@Nullable CreateEnvironmentRequestNe return this; } - /** * Sources to be mounted into the environment. */ @@ -99,7 +97,6 @@ public CreateEnvironmentRequest withSources(@Nullable List sources) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -109,33 +106,29 @@ public boolean equals(java.lang.Object o) { return false; } CreateEnvironmentRequest other = (CreateEnvironmentRequest) o; - return - Utils.enhancedDeepEquals(this.network, other.network) && - Utils.enhancedDeepEquals(this.sources, other.sources); + return Utils.enhancedDeepEquals(this.network, other.network) + && Utils.enhancedDeepEquals(this.sources, other.sources); } - + @Override public int hashCode() { - return Utils.enhancedHash( - network, sources); + return Utils.enhancedHash(network, sources); } - + @Override public String toString() { - return Utils.toString(CreateEnvironmentRequest.class, - "network", network, - "sources", sources); + return Utils.toString(CreateEnvironmentRequest.class, "network", network, "sources", sources); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private CreateEnvironmentRequestNetworkUnion network; private List sources; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -155,9 +148,7 @@ public Builder sources(@Nullable List sources) { } public CreateEnvironmentRequest build() { - return new CreateEnvironmentRequest( - network, sources); + return new CreateEnvironmentRequest(network, sources); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/environments/CreateEnvironmentRequestNetworkEnum.java b/src/main/java/com/google/genai/gaos/models/environments/CreateEnvironmentRequestNetworkEnum.java index a51704fea28..e0d2f00f16d 100644 --- a/src/main/java/com/google/genai/gaos/models/environments/CreateEnvironmentRequestNetworkEnum.java +++ b/src/main/java/com/google/genai/gaos/models/environments/CreateEnvironmentRequestNetworkEnum.java @@ -33,13 +33,13 @@ public enum CreateEnvironmentRequestNetworkEnum { CreateEnvironmentRequestNetworkEnum(String value) { this.value = value; } - + public String value() { return value; } - + public static Optional fromValue(String value) { - for (CreateEnvironmentRequestNetworkEnum o: CreateEnvironmentRequestNetworkEnum.values()) { + for (CreateEnvironmentRequestNetworkEnum o : CreateEnvironmentRequestNetworkEnum.values()) { if (Objects.deepEquals(o.value, value)) { return Optional.of(o); } @@ -47,4 +47,3 @@ public static Optional fromValue(String val return Optional.empty(); } } - diff --git a/src/main/java/com/google/genai/gaos/models/environments/CreateEnvironmentRequestNetworkUnion.java b/src/main/java/com/google/genai/gaos/models/environments/CreateEnvironmentRequestNetworkUnion.java index 44a882f10c1..87993cd7fd3 100644 --- a/src/main/java/com/google/genai/gaos/models/environments/CreateEnvironmentRequestNetworkUnion.java +++ b/src/main/java/com/google/genai/gaos/models/environments/CreateEnvironmentRequestNetworkUnion.java @@ -26,9 +26,9 @@ import com.google.genai.gaos.models.interactions.EnvironmentNetworkEgressAllowlist; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -36,7 +36,7 @@ /** * CreateEnvironmentRequestNetworkUnion - * + * *

Network configuration for the environment. */ @JsonDeserialize(using = CreateEnvironmentRequestNetworkUnion._Deserializer.class) @@ -44,21 +44,23 @@ public class CreateEnvironmentRequestNetworkUnion { @JsonValue private final TypedObject value; - + private CreateEnvironmentRequestNetworkUnion(TypedObject value) { this.value = value; } public static CreateEnvironmentRequestNetworkUnion of(EnvironmentNetworkEgressAllowlist value) { Utils.checkNotNull(value, "value"); - return new CreateEnvironmentRequestNetworkUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateEnvironmentRequestNetworkUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static CreateEnvironmentRequestNetworkUnion of(CreateEnvironmentRequestNetworkEnum value) { Utils.checkNotNull(value, "value"); - return new CreateEnvironmentRequestNetworkUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateEnvironmentRequestNetworkUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code EnvironmentNetworkEgressAllowlist}, * otherwise returns an empty {@link Optional}. @@ -71,7 +73,7 @@ public Optional environmentNetworkEgressAllow } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code CreateEnvironmentRequestNetworkEnum}, * otherwise returns an empty {@link Optional}. @@ -84,19 +86,19 @@ public Optional createEnvironmentRequestNet } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -108,27 +110,28 @@ public boolean equals(java.lang.Object o) { CreateEnvironmentRequestNetworkUnion other = (CreateEnvironmentRequestNetworkUnion) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(CreateEnvironmentRequestNetworkUnion.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + CreateEnvironmentRequestNetworkUnion.class, + false, + TypeReferenceWithShape.of( + new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of( + new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(CreateEnvironmentRequestNetworkUnion.class, - "value", value); + return Utils.toString(CreateEnvironmentRequestNetworkUnion.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/environments/Environment.java b/src/main/java/com/google/genai/gaos/models/environments/Environment.java index 05394dbe8f0..0de35d719b6 100644 --- a/src/main/java/com/google/genai/gaos/models/environments/Environment.java +++ b/src/main/java/com/google/genai/gaos/models/environments/Environment.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.environments; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.models.interactions.Source; import com.google.genai.gaos.utils.Utils; @@ -34,7 +34,7 @@ /** * Environment - * + * *

An execution environment for an agent. */ public class Environment { @@ -116,8 +116,7 @@ public Environment( @JsonProperty("updated") @Nullable String updated) { this.created = created; this.fileCount = fileCount; - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); this.lastAccessed = lastAccessed; this.network = network; this.sizeBytes = sizeBytes; @@ -125,12 +124,9 @@ public Environment( this.status = status; this.updated = updated; } - - public Environment( - @Nonnull String id) { - this(null, null, id, - null, null, null, - null, null, null); + + public Environment(@Nonnull String id) { + this(null, null, id, null, null, null, null, null, null); } /** @@ -203,7 +199,6 @@ public static Builder builder() { return new Builder(); } - /** * Output only. The time at which the environment was created in ISO 8601 format * (YYYY-MM-DDThh:mm:ssZ). @@ -213,7 +208,6 @@ public Environment withCreated(@Nullable String created) { return this; } - /** * Output only. The number of files in the environment, output only. */ @@ -222,7 +216,6 @@ public Environment withFileCount(@Nullable String fileCount) { return this; } - /** * Required. Output only. The ID of the environment. */ @@ -231,7 +224,6 @@ public Environment withId(@Nonnull String id) { return this; } - /** * Output only. The time at which the environment was last accessed in ISO 8601 format * (YYYY-MM-DDThh:mm:ssZ). @@ -241,7 +233,6 @@ public Environment withLastAccessed(@Nullable String lastAccessed) { return this; } - /** * Network configuration for the environment. */ @@ -250,7 +241,6 @@ public Environment withNetwork(@Nullable EnvironmentNetworkUnion network) { return this; } - /** * Output only. The total size of the environment files in bytes, output only. */ @@ -259,7 +249,6 @@ public Environment withSizeBytes(@Nullable String sizeBytes) { return this; } - /** * Sources to be mounted into the environment. */ @@ -268,7 +257,6 @@ public Environment withSources(@Nullable List sources) { return this; } - /** * Output only. The status of the environment container. */ @@ -277,7 +265,6 @@ public Environment withStatus(@Nullable Status status) { return this; } - /** * Output only. The time at which the environment was last updated in ISO 8601 format * (YYYY-MM-DDThh:mm:ssZ). @@ -287,7 +274,6 @@ public Environment withUpdated(@Nullable String updated) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -297,42 +283,48 @@ public boolean equals(java.lang.Object o) { return false; } Environment other = (Environment) o; - return - Utils.enhancedDeepEquals(this.created, other.created) && - Utils.enhancedDeepEquals(this.fileCount, other.fileCount) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.lastAccessed, other.lastAccessed) && - Utils.enhancedDeepEquals(this.network, other.network) && - Utils.enhancedDeepEquals(this.sizeBytes, other.sizeBytes) && - Utils.enhancedDeepEquals(this.sources, other.sources) && - Utils.enhancedDeepEquals(this.status, other.status) && - Utils.enhancedDeepEquals(this.updated, other.updated); + return Utils.enhancedDeepEquals(this.created, other.created) + && Utils.enhancedDeepEquals(this.fileCount, other.fileCount) + && Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.lastAccessed, other.lastAccessed) + && Utils.enhancedDeepEquals(this.network, other.network) + && Utils.enhancedDeepEquals(this.sizeBytes, other.sizeBytes) + && Utils.enhancedDeepEquals(this.sources, other.sources) + && Utils.enhancedDeepEquals(this.status, other.status) + && Utils.enhancedDeepEquals(this.updated, other.updated); } - + @Override public int hashCode() { - return Utils.enhancedHash( - created, fileCount, id, - lastAccessed, network, sizeBytes, - sources, status, updated); + return Utils.enhancedHash(created, fileCount, id, lastAccessed, network, sizeBytes, sources, status, updated); } - + @Override public String toString() { - return Utils.toString(Environment.class, - "created", created, - "fileCount", fileCount, - "id", id, - "lastAccessed", lastAccessed, - "network", network, - "sizeBytes", sizeBytes, - "sources", sources, - "status", status, - "updated", updated); + return Utils.toString( + Environment.class, + "created", + created, + "fileCount", + fileCount, + "id", + id, + "lastAccessed", + lastAccessed, + "network", + network, + "sizeBytes", + sizeBytes, + "sources", + sources, + "status", + status, + "updated", + updated); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String created; @@ -353,7 +345,7 @@ public final static class Builder { private String updated; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -432,11 +424,7 @@ public Builder updated(@Nullable String updated) { } public Environment build() { - return new Environment( - created, fileCount, id, - lastAccessed, network, sizeBytes, - sources, status, updated); + return new Environment(created, fileCount, id, lastAccessed, network, sizeBytes, sources, status, updated); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/environments/EnvironmentNetworkEnum.java b/src/main/java/com/google/genai/gaos/models/environments/EnvironmentNetworkEnum.java index d924e02f1d3..3f4d9431c38 100644 --- a/src/main/java/com/google/genai/gaos/models/environments/EnvironmentNetworkEnum.java +++ b/src/main/java/com/google/genai/gaos/models/environments/EnvironmentNetworkEnum.java @@ -53,12 +53,12 @@ private EnvironmentNetworkEnum(String value) { } /** - * Returns a EnvironmentNetworkEnum with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a EnvironmentNetworkEnum with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as EnvironmentNetworkEnum - */ + */ @JsonCreator public static EnvironmentNetworkEnum of(String value) { synchronized (EnvironmentNetworkEnum.class) { @@ -86,12 +86,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; EnvironmentNetworkEnum other = (EnvironmentNetworkEnum) obj; return Objects.equals(value, other.value); } @@ -119,11 +116,11 @@ private static final Map createEnumsMap() { map.put("disabled", EnvironmentNetworkEnumEnum.DISABLED); return map; } - - + public enum EnvironmentNetworkEnumEnum { - DISABLED("disabled"),; + DISABLED("disabled"), + ; private final String value; @@ -136,4 +133,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/environments/EnvironmentNetworkUnion.java b/src/main/java/com/google/genai/gaos/models/environments/EnvironmentNetworkUnion.java index 1ce1831c3df..d9bdb1453b6 100644 --- a/src/main/java/com/google/genai/gaos/models/environments/EnvironmentNetworkUnion.java +++ b/src/main/java/com/google/genai/gaos/models/environments/EnvironmentNetworkUnion.java @@ -26,9 +26,9 @@ import com.google.genai.gaos.models.interactions.EnvironmentNetworkEgressAllowlist; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -36,7 +36,7 @@ /** * EnvironmentNetworkUnion - * + * *

Network configuration for the environment. */ @JsonDeserialize(using = EnvironmentNetworkUnion._Deserializer.class) @@ -44,21 +44,23 @@ public class EnvironmentNetworkUnion { @JsonValue private final TypedObject value; - + private EnvironmentNetworkUnion(TypedObject value) { this.value = value; } public static EnvironmentNetworkUnion of(EnvironmentNetworkEgressAllowlist value) { Utils.checkNotNull(value, "value"); - return new EnvironmentNetworkUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new EnvironmentNetworkUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static EnvironmentNetworkUnion of(EnvironmentNetworkEnum value) { Utils.checkNotNull(value, "value"); - return new EnvironmentNetworkUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new EnvironmentNetworkUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code EnvironmentNetworkEgressAllowlist}, * otherwise returns an empty {@link Optional}. @@ -71,7 +73,7 @@ public Optional environmentNetworkEgressAllow } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code EnvironmentNetworkEnum}, * otherwise returns an empty {@link Optional}. @@ -84,19 +86,19 @@ public Optional environmentNetworkEnum() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -108,27 +110,27 @@ public boolean equals(java.lang.Object o) { EnvironmentNetworkUnion other = (EnvironmentNetworkUnion) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(EnvironmentNetworkUnion.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + EnvironmentNetworkUnion.class, + false, + TypeReferenceWithShape.of( + new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(EnvironmentNetworkUnion.class, - "value", value); + return Utils.toString(EnvironmentNetworkUnion.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/environments/ListEnvironmentsResponse.java b/src/main/java/com/google/genai/gaos/models/environments/ListEnvironmentsResponse.java index e6e001df1f3..80cd296a680 100644 --- a/src/main/java/com/google/genai/gaos/models/environments/ListEnvironmentsResponse.java +++ b/src/main/java/com/google/genai/gaos/models/environments/ListEnvironmentsResponse.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.environments; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * ListEnvironmentsResponse - * + * *

Response for `ListEnvironments`. */ public class ListEnvironmentsResponse { @@ -57,7 +57,7 @@ public ListEnvironmentsResponse( this.environments = environments; this.nextPageToken = nextPageToken; } - + public ListEnvironmentsResponse() { this(null, null); } @@ -80,7 +80,6 @@ public static Builder builder() { return new Builder(); } - /** * Environments belonging to the provided project. */ @@ -89,7 +88,6 @@ public ListEnvironmentsResponse withEnvironments(@Nullable List env return this; } - /** * Pagination token. */ @@ -98,7 +96,6 @@ public ListEnvironmentsResponse withNextPageToken(@Nullable String nextPageToken return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -108,33 +105,30 @@ public boolean equals(java.lang.Object o) { return false; } ListEnvironmentsResponse other = (ListEnvironmentsResponse) o; - return - Utils.enhancedDeepEquals(this.environments, other.environments) && - Utils.enhancedDeepEquals(this.nextPageToken, other.nextPageToken); + return Utils.enhancedDeepEquals(this.environments, other.environments) + && Utils.enhancedDeepEquals(this.nextPageToken, other.nextPageToken); } - + @Override public int hashCode() { - return Utils.enhancedHash( - environments, nextPageToken); + return Utils.enhancedHash(environments, nextPageToken); } - + @Override public String toString() { - return Utils.toString(ListEnvironmentsResponse.class, - "environments", environments, - "nextPageToken", nextPageToken); + return Utils.toString( + ListEnvironmentsResponse.class, "environments", environments, "nextPageToken", nextPageToken); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List environments; private String nextPageToken; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -154,9 +148,7 @@ public Builder nextPageToken(@Nullable String nextPageToken) { } public ListEnvironmentsResponse build() { - return new ListEnvironmentsResponse( - environments, nextPageToken); + return new ListEnvironmentsResponse(environments, nextPageToken); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/environments/Status.java b/src/main/java/com/google/genai/gaos/models/environments/Status.java index 5f0c1343e9d..5de67b8c9ef 100644 --- a/src/main/java/com/google/genai/gaos/models/environments/Status.java +++ b/src/main/java/com/google/genai/gaos/models/environments/Status.java @@ -36,7 +36,7 @@ */ /** * Status - * + * *

Output only. The status of the environment container. */ public class Status { @@ -59,12 +59,12 @@ private Status(String value) { } /** - * Returns a Status with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a Status with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as Status - */ + */ @JsonCreator public static Status of(String value) { synchronized (Status.class) { @@ -92,12 +92,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; Status other = (Status) obj; return Objects.equals(value, other.value); } @@ -127,12 +124,12 @@ private static final Map createEnumsMap() { map.put("expired", StatusEnum.EXPIRED); return map; } - - + public enum StatusEnum { ACTIVE("active"), - EXPIRED("expired"),; + EXPIRED("expired"), + ; private final String value; @@ -145,4 +142,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/errors/AuthException.java b/src/main/java/com/google/genai/gaos/models/errors/AuthException.java index 8a53836c7b6..5d1545a4d4d 100644 --- a/src/main/java/com/google/genai/gaos/models/errors/AuthException.java +++ b/src/main/java/com/google/genai/gaos/models/errors/AuthException.java @@ -19,18 +19,18 @@ */ package com.google.genai.gaos.models.errors; -import java.io.InputStream; import com.google.genai.gaos.utils.transport.HttpResponse; +import java.io.InputStream; import java.util.Optional; /** * An exception associated with Authentication or Authorization. */ @SuppressWarnings("serial") -public class AuthException extends GenAiException { +public class AuthException extends GaosClientException { public AuthException(String message, int code, byte[] body, HttpResponse rawResponse) { - super(message, code, body, rawResponse, null); + super(message, code, body, rawResponse, null); } /** @@ -42,7 +42,7 @@ public AuthException(String message, int code, byte[] body, HttpResponse statusCode() { return Optional.of(super.code()); } - + @SuppressWarnings("unchecked") @Override public HttpResponse rawResponse() { diff --git a/src/main/java/com/google/genai/gaos/models/errors/CancelInteractionByIdClientError.java b/src/main/java/com/google/genai/gaos/models/errors/CancelInteractionByIdClientError.java index 61cd897a6d4..959bfbdfcd9 100644 --- a/src/main/java/com/google/genai/gaos/models/errors/CancelInteractionByIdClientError.java +++ b/src/main/java/com/google/genai/gaos/models/errors/CancelInteractionByIdClientError.java @@ -35,7 +35,7 @@ import java.util.Optional; @SuppressWarnings("serial") -public class CancelInteractionByIdClientError extends GenAiException { +public class CancelInteractionByIdClientError extends GaosClientException { @Nullable private final Data data; @@ -44,20 +44,20 @@ public class CancelInteractionByIdClientError extends GenAiException { private final Throwable deserializationException; public CancelInteractionByIdClientError( - int code, - byte[] body, - HttpResponse rawResponse, - @Nullable Data data, - @Nullable Throwable deserializationException) { + int code, + byte[] body, + HttpResponse rawResponse, + @Nullable Data data, + @Nullable Throwable deserializationException) { super("API error occurred", code, body, rawResponse, null); this.data = data; this.deserializationException = deserializationException; } /** - * Parse a response into an instance of CancelInteractionByIdClientError. If deserialization of the response body fails, - * the resulting CancelInteractionByIdClientError instance will have a null data() value and a non-null deserializationException(). - */ + * Parse a response into an instance of CancelInteractionByIdClientError. If deserialization of the response body fails, + * the resulting CancelInteractionByIdClientError instance will have a null data() value and a non-null deserializationException(). + */ public static CancelInteractionByIdClientError from(HttpResponse response) { try { byte[] bytes = Utils.extractByteArrayFromBody(response); @@ -88,7 +88,7 @@ public Optional deserializationException() { } /** * Data - * + * *

Error cancelling interaction */ public static class Data { @@ -99,10 +99,9 @@ public static class Data { private Error error; @JsonCreator - public Data( - @JsonProperty("error") @Nonnull Error error) { - this.error = Optional.ofNullable(error) - .orElseThrow(() -> new IllegalArgumentException("error cannot be null")); + public Data(@JsonProperty("error") @Nonnull Error error) { + this.error = + Optional.ofNullable(error).orElseThrow(() -> new IllegalArgumentException("error cannot be null")); } /** @@ -116,7 +115,6 @@ public static Builder builder() { return new Builder(); } - /** * Error message from an interaction. */ @@ -125,7 +123,6 @@ public Data withError(@Nonnull Error error) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -135,29 +132,26 @@ public boolean equals(java.lang.Object o) { return false; } Data other = (Data) o; - return - Utils.enhancedDeepEquals(this.error, other.error); + return Utils.enhancedDeepEquals(this.error, other.error); } - + @Override public int hashCode() { - return Utils.enhancedHash( - error); + return Utils.enhancedHash(error); } - + @Override public String toString() { - return Utils.toString(Data.class, - "error", error); + return Utils.toString(Data.class, "error", error); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Error error; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -169,12 +163,8 @@ public Builder error(@Nonnull Error error) { } public Data build() { - return new Data( - error); + return new Data(error); } - } } - } - diff --git a/src/main/java/com/google/genai/gaos/models/errors/CancelInteractionByIdServerError.java b/src/main/java/com/google/genai/gaos/models/errors/CancelInteractionByIdServerError.java index 9b648ab343c..3b54949e5d8 100644 --- a/src/main/java/com/google/genai/gaos/models/errors/CancelInteractionByIdServerError.java +++ b/src/main/java/com/google/genai/gaos/models/errors/CancelInteractionByIdServerError.java @@ -35,7 +35,7 @@ import java.util.Optional; @SuppressWarnings("serial") -public class CancelInteractionByIdServerError extends GenAiException { +public class CancelInteractionByIdServerError extends GaosServerException { @Nullable private final Data data; @@ -44,20 +44,20 @@ public class CancelInteractionByIdServerError extends GenAiException { private final Throwable deserializationException; public CancelInteractionByIdServerError( - int code, - byte[] body, - HttpResponse rawResponse, - @Nullable Data data, - @Nullable Throwable deserializationException) { + int code, + byte[] body, + HttpResponse rawResponse, + @Nullable Data data, + @Nullable Throwable deserializationException) { super("API error occurred", code, body, rawResponse, null); this.data = data; this.deserializationException = deserializationException; } /** - * Parse a response into an instance of CancelInteractionByIdServerError. If deserialization of the response body fails, - * the resulting CancelInteractionByIdServerError instance will have a null data() value and a non-null deserializationException(). - */ + * Parse a response into an instance of CancelInteractionByIdServerError. If deserialization of the response body fails, + * the resulting CancelInteractionByIdServerError instance will have a null data() value and a non-null deserializationException(). + */ public static CancelInteractionByIdServerError from(HttpResponse response) { try { byte[] bytes = Utils.extractByteArrayFromBody(response); @@ -88,7 +88,7 @@ public Optional deserializationException() { } /** * Data - * + * *

Error cancelling interaction */ public static class Data { @@ -99,10 +99,9 @@ public static class Data { private Error error; @JsonCreator - public Data( - @JsonProperty("error") @Nonnull Error error) { - this.error = Optional.ofNullable(error) - .orElseThrow(() -> new IllegalArgumentException("error cannot be null")); + public Data(@JsonProperty("error") @Nonnull Error error) { + this.error = + Optional.ofNullable(error).orElseThrow(() -> new IllegalArgumentException("error cannot be null")); } /** @@ -116,7 +115,6 @@ public static Builder builder() { return new Builder(); } - /** * Error message from an interaction. */ @@ -125,7 +123,6 @@ public Data withError(@Nonnull Error error) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -135,29 +132,26 @@ public boolean equals(java.lang.Object o) { return false; } Data other = (Data) o; - return - Utils.enhancedDeepEquals(this.error, other.error); + return Utils.enhancedDeepEquals(this.error, other.error); } - + @Override public int hashCode() { - return Utils.enhancedHash( - error); + return Utils.enhancedHash(error); } - + @Override public String toString() { - return Utils.toString(Data.class, - "error", error); + return Utils.toString(Data.class, "error", error); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Error error; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -169,12 +163,8 @@ public Builder error(@Nonnull Error error) { } public Data build() { - return new Data( - error); + return new Data(error); } - } } - } - diff --git a/src/main/java/com/google/genai/gaos/models/errors/CreateInteractionClientError.java b/src/main/java/com/google/genai/gaos/models/errors/CreateInteractionClientError.java index e2ef8d40337..4e88b7ae3a7 100644 --- a/src/main/java/com/google/genai/gaos/models/errors/CreateInteractionClientError.java +++ b/src/main/java/com/google/genai/gaos/models/errors/CreateInteractionClientError.java @@ -35,7 +35,7 @@ import java.util.Optional; @SuppressWarnings("serial") -public class CreateInteractionClientError extends GenAiException { +public class CreateInteractionClientError extends GaosClientException { @Nullable private final Data data; @@ -44,20 +44,20 @@ public class CreateInteractionClientError extends GenAiException { private final Throwable deserializationException; public CreateInteractionClientError( - int code, - byte[] body, - HttpResponse rawResponse, - @Nullable Data data, - @Nullable Throwable deserializationException) { + int code, + byte[] body, + HttpResponse rawResponse, + @Nullable Data data, + @Nullable Throwable deserializationException) { super("API error occurred", code, body, rawResponse, null); this.data = data; this.deserializationException = deserializationException; } /** - * Parse a response into an instance of CreateInteractionClientError. If deserialization of the response body fails, - * the resulting CreateInteractionClientError instance will have a null data() value and a non-null deserializationException(). - */ + * Parse a response into an instance of CreateInteractionClientError. If deserialization of the response body fails, + * the resulting CreateInteractionClientError instance will have a null data() value and a non-null deserializationException(). + */ public static CreateInteractionClientError from(HttpResponse response) { try { byte[] bytes = Utils.extractByteArrayFromBody(response); @@ -88,7 +88,7 @@ public Optional deserializationException() { } /** * Data - * + * *

Error creating interaction */ public static class Data { @@ -99,10 +99,9 @@ public static class Data { private Error error; @JsonCreator - public Data( - @JsonProperty("error") @Nonnull Error error) { - this.error = Optional.ofNullable(error) - .orElseThrow(() -> new IllegalArgumentException("error cannot be null")); + public Data(@JsonProperty("error") @Nonnull Error error) { + this.error = + Optional.ofNullable(error).orElseThrow(() -> new IllegalArgumentException("error cannot be null")); } /** @@ -116,7 +115,6 @@ public static Builder builder() { return new Builder(); } - /** * Error message from an interaction. */ @@ -125,7 +123,6 @@ public Data withError(@Nonnull Error error) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -135,29 +132,26 @@ public boolean equals(java.lang.Object o) { return false; } Data other = (Data) o; - return - Utils.enhancedDeepEquals(this.error, other.error); + return Utils.enhancedDeepEquals(this.error, other.error); } - + @Override public int hashCode() { - return Utils.enhancedHash( - error); + return Utils.enhancedHash(error); } - + @Override public String toString() { - return Utils.toString(Data.class, - "error", error); + return Utils.toString(Data.class, "error", error); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Error error; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -169,12 +163,8 @@ public Builder error(@Nonnull Error error) { } public Data build() { - return new Data( - error); + return new Data(error); } - } } - } - diff --git a/src/main/java/com/google/genai/gaos/models/errors/CreateInteractionServerError.java b/src/main/java/com/google/genai/gaos/models/errors/CreateInteractionServerError.java index 69140c0f501..1b579bd2cce 100644 --- a/src/main/java/com/google/genai/gaos/models/errors/CreateInteractionServerError.java +++ b/src/main/java/com/google/genai/gaos/models/errors/CreateInteractionServerError.java @@ -35,7 +35,7 @@ import java.util.Optional; @SuppressWarnings("serial") -public class CreateInteractionServerError extends GenAiException { +public class CreateInteractionServerError extends GaosServerException { @Nullable private final Data data; @@ -44,20 +44,20 @@ public class CreateInteractionServerError extends GenAiException { private final Throwable deserializationException; public CreateInteractionServerError( - int code, - byte[] body, - HttpResponse rawResponse, - @Nullable Data data, - @Nullable Throwable deserializationException) { + int code, + byte[] body, + HttpResponse rawResponse, + @Nullable Data data, + @Nullable Throwable deserializationException) { super("API error occurred", code, body, rawResponse, null); this.data = data; this.deserializationException = deserializationException; } /** - * Parse a response into an instance of CreateInteractionServerError. If deserialization of the response body fails, - * the resulting CreateInteractionServerError instance will have a null data() value and a non-null deserializationException(). - */ + * Parse a response into an instance of CreateInteractionServerError. If deserialization of the response body fails, + * the resulting CreateInteractionServerError instance will have a null data() value and a non-null deserializationException(). + */ public static CreateInteractionServerError from(HttpResponse response) { try { byte[] bytes = Utils.extractByteArrayFromBody(response); @@ -88,7 +88,7 @@ public Optional deserializationException() { } /** * Data - * + * *

Error creating interaction */ public static class Data { @@ -99,10 +99,9 @@ public static class Data { private Error error; @JsonCreator - public Data( - @JsonProperty("error") @Nonnull Error error) { - this.error = Optional.ofNullable(error) - .orElseThrow(() -> new IllegalArgumentException("error cannot be null")); + public Data(@JsonProperty("error") @Nonnull Error error) { + this.error = + Optional.ofNullable(error).orElseThrow(() -> new IllegalArgumentException("error cannot be null")); } /** @@ -116,7 +115,6 @@ public static Builder builder() { return new Builder(); } - /** * Error message from an interaction. */ @@ -125,7 +123,6 @@ public Data withError(@Nonnull Error error) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -135,29 +132,26 @@ public boolean equals(java.lang.Object o) { return false; } Data other = (Data) o; - return - Utils.enhancedDeepEquals(this.error, other.error); + return Utils.enhancedDeepEquals(this.error, other.error); } - + @Override public int hashCode() { - return Utils.enhancedHash( - error); + return Utils.enhancedHash(error); } - + @Override public String toString() { - return Utils.toString(Data.class, - "error", error); + return Utils.toString(Data.class, "error", error); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Error error; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -169,12 +163,8 @@ public Builder error(@Nonnull Error error) { } public Data build() { - return new Data( - error); + return new Data(error); } - } } - } - diff --git a/src/main/java/com/google/genai/gaos/models/errors/DeleteInteractionClientError.java b/src/main/java/com/google/genai/gaos/models/errors/DeleteInteractionClientError.java index 1d0045ebe82..cc3e2a1eb53 100644 --- a/src/main/java/com/google/genai/gaos/models/errors/DeleteInteractionClientError.java +++ b/src/main/java/com/google/genai/gaos/models/errors/DeleteInteractionClientError.java @@ -35,7 +35,7 @@ import java.util.Optional; @SuppressWarnings("serial") -public class DeleteInteractionClientError extends GenAiException { +public class DeleteInteractionClientError extends GaosClientException { @Nullable private final Data data; @@ -44,20 +44,20 @@ public class DeleteInteractionClientError extends GenAiException { private final Throwable deserializationException; public DeleteInteractionClientError( - int code, - byte[] body, - HttpResponse rawResponse, - @Nullable Data data, - @Nullable Throwable deserializationException) { + int code, + byte[] body, + HttpResponse rawResponse, + @Nullable Data data, + @Nullable Throwable deserializationException) { super("API error occurred", code, body, rawResponse, null); this.data = data; this.deserializationException = deserializationException; } /** - * Parse a response into an instance of DeleteInteractionClientError. If deserialization of the response body fails, - * the resulting DeleteInteractionClientError instance will have a null data() value and a non-null deserializationException(). - */ + * Parse a response into an instance of DeleteInteractionClientError. If deserialization of the response body fails, + * the resulting DeleteInteractionClientError instance will have a null data() value and a non-null deserializationException(). + */ public static DeleteInteractionClientError from(HttpResponse response) { try { byte[] bytes = Utils.extractByteArrayFromBody(response); @@ -88,7 +88,7 @@ public Optional deserializationException() { } /** * Data - * + * *

Error deleting interaction */ public static class Data { @@ -99,10 +99,9 @@ public static class Data { private Error error; @JsonCreator - public Data( - @JsonProperty("error") @Nonnull Error error) { - this.error = Optional.ofNullable(error) - .orElseThrow(() -> new IllegalArgumentException("error cannot be null")); + public Data(@JsonProperty("error") @Nonnull Error error) { + this.error = + Optional.ofNullable(error).orElseThrow(() -> new IllegalArgumentException("error cannot be null")); } /** @@ -116,7 +115,6 @@ public static Builder builder() { return new Builder(); } - /** * Error message from an interaction. */ @@ -125,7 +123,6 @@ public Data withError(@Nonnull Error error) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -135,29 +132,26 @@ public boolean equals(java.lang.Object o) { return false; } Data other = (Data) o; - return - Utils.enhancedDeepEquals(this.error, other.error); + return Utils.enhancedDeepEquals(this.error, other.error); } - + @Override public int hashCode() { - return Utils.enhancedHash( - error); + return Utils.enhancedHash(error); } - + @Override public String toString() { - return Utils.toString(Data.class, - "error", error); + return Utils.toString(Data.class, "error", error); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Error error; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -169,12 +163,8 @@ public Builder error(@Nonnull Error error) { } public Data build() { - return new Data( - error); + return new Data(error); } - } } - } - diff --git a/src/main/java/com/google/genai/gaos/models/errors/DeleteInteractionServerError.java b/src/main/java/com/google/genai/gaos/models/errors/DeleteInteractionServerError.java index 322280134d9..eb0e0f4120a 100644 --- a/src/main/java/com/google/genai/gaos/models/errors/DeleteInteractionServerError.java +++ b/src/main/java/com/google/genai/gaos/models/errors/DeleteInteractionServerError.java @@ -35,7 +35,7 @@ import java.util.Optional; @SuppressWarnings("serial") -public class DeleteInteractionServerError extends GenAiException { +public class DeleteInteractionServerError extends GaosServerException { @Nullable private final Data data; @@ -44,20 +44,20 @@ public class DeleteInteractionServerError extends GenAiException { private final Throwable deserializationException; public DeleteInteractionServerError( - int code, - byte[] body, - HttpResponse rawResponse, - @Nullable Data data, - @Nullable Throwable deserializationException) { + int code, + byte[] body, + HttpResponse rawResponse, + @Nullable Data data, + @Nullable Throwable deserializationException) { super("API error occurred", code, body, rawResponse, null); this.data = data; this.deserializationException = deserializationException; } /** - * Parse a response into an instance of DeleteInteractionServerError. If deserialization of the response body fails, - * the resulting DeleteInteractionServerError instance will have a null data() value and a non-null deserializationException(). - */ + * Parse a response into an instance of DeleteInteractionServerError. If deserialization of the response body fails, + * the resulting DeleteInteractionServerError instance will have a null data() value and a non-null deserializationException(). + */ public static DeleteInteractionServerError from(HttpResponse response) { try { byte[] bytes = Utils.extractByteArrayFromBody(response); @@ -88,7 +88,7 @@ public Optional deserializationException() { } /** * Data - * + * *

Error deleting interaction */ public static class Data { @@ -99,10 +99,9 @@ public static class Data { private Error error; @JsonCreator - public Data( - @JsonProperty("error") @Nonnull Error error) { - this.error = Optional.ofNullable(error) - .orElseThrow(() -> new IllegalArgumentException("error cannot be null")); + public Data(@JsonProperty("error") @Nonnull Error error) { + this.error = + Optional.ofNullable(error).orElseThrow(() -> new IllegalArgumentException("error cannot be null")); } /** @@ -116,7 +115,6 @@ public static Builder builder() { return new Builder(); } - /** * Error message from an interaction. */ @@ -125,7 +123,6 @@ public Data withError(@Nonnull Error error) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -135,29 +132,26 @@ public boolean equals(java.lang.Object o) { return false; } Data other = (Data) o; - return - Utils.enhancedDeepEquals(this.error, other.error); + return Utils.enhancedDeepEquals(this.error, other.error); } - + @Override public int hashCode() { - return Utils.enhancedHash( - error); + return Utils.enhancedHash(error); } - + @Override public String toString() { - return Utils.toString(Data.class, - "error", error); + return Utils.toString(Data.class, "error", error); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Error error; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -169,12 +163,8 @@ public Builder error(@Nonnull Error error) { } public Data build() { - return new Data( - error); + return new Data(error); } - } } - } - diff --git a/src/main/java/com/google/genai/gaos/models/errors/SDKException.java b/src/main/java/com/google/genai/gaos/models/errors/GaosApiException.java similarity index 79% rename from src/main/java/com/google/genai/gaos/models/errors/SDKException.java rename to src/main/java/com/google/genai/gaos/models/errors/GaosApiException.java index 0469707e433..93c46aeb437 100644 --- a/src/main/java/com/google/genai/gaos/models/errors/SDKException.java +++ b/src/main/java/com/google/genai/gaos/models/errors/GaosApiException.java @@ -19,20 +19,19 @@ */ package com.google.genai.gaos.models.errors; -import jakarta.annotation.Nullable; import com.google.genai.gaos.utils.Utils; - +import com.google.genai.gaos.utils.transport.HttpResponse; +import jakarta.annotation.Nullable; import java.io.IOException; import java.io.InputStream; -import com.google.genai.gaos.utils.transport.HttpResponse; /** * Thrown by a service call when an error response occurs. Contains details about the response. */ @SuppressWarnings("serial") -public class SDKException extends GenAiException { +public class GaosApiException extends GaosBaseException { - public SDKException( + public GaosApiException( String message, int code, @Nullable byte[] body, @@ -41,22 +40,22 @@ public SDKException( super(message, code, body, rawResponse, cause); } - public static SDKException from(String message, HttpResponse rawResponse) { + public static GaosApiException from(String message, HttpResponse rawResponse) { return from(message, rawResponse, null); } - public static SDKException from(String message, HttpResponse rawResponse, @Nullable Throwable cause) { + public static GaosApiException from( + String message, HttpResponse rawResponse, @Nullable Throwable cause) { try { - return new SDKException( + return new GaosApiException( message, rawResponse.statusCode(), Utils.extractByteArrayFromBody(rawResponse), rawResponse, cause); } catch (IOException e) { // Gracefully handle IOExceptions that occur while reading the body // by returning an error without a body. - return new SDKException( - message, rawResponse.statusCode(), null, rawResponse, cause); + return new GaosApiException(message, rawResponse.statusCode(), null, rawResponse, cause); } } - + @SuppressWarnings("unchecked") @Override public HttpResponse rawResponse() { diff --git a/src/main/java/com/google/genai/gaos/models/errors/GenAiException.java b/src/main/java/com/google/genai/gaos/models/errors/GaosBaseException.java similarity index 72% rename from src/main/java/com/google/genai/gaos/models/errors/GenAiException.java rename to src/main/java/com/google/genai/gaos/models/errors/GaosBaseException.java index d63785ad989..f156d30b3e6 100644 --- a/src/main/java/com/google/genai/gaos/models/errors/GenAiException.java +++ b/src/main/java/com/google/genai/gaos/models/errors/GaosBaseException.java @@ -19,93 +19,98 @@ */ package com.google.genai.gaos.models.errors; -import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Headers; - -import jakarta.annotation.Nullable; - +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.transport.HttpResponse; +import jakarta.annotation.Nullable; import java.nio.charset.StandardCharsets; import java.util.Optional; @SuppressWarnings("serial") -public abstract class GenAiException extends RuntimeException { +public abstract class GaosBaseException extends com.google.genai.errors.ApiException { private int code; private byte[] body; private HttpResponse rawResponse; - public GenAiException(String message, int code, @Nullable byte[] body, HttpResponse rawResponse, @Nullable Throwable cause) { - super(message, cause); + public GaosBaseException( + String message, int code, @Nullable byte[] body, HttpResponse rawResponse, @Nullable Throwable cause) { + super(code, "", message, cause); Utils.checkNotNull(message, "message"); Utils.checkNotNull(rawResponse, "rawResponse"); this.body = body; this.code = code; this.rawResponse = rawResponse; } - + public Optional body() { return Optional.ofNullable(body); } - + public Optional bodyAsString() { return body().map(x -> new String(x, StandardCharsets.UTF_8)); } - + public int code() { return code; } - + /** * Returns the raw HTTP response associated with this exception. The response body stream * may not be available (but the body can be accessed via the {@code body()} method). - * + * * @return the raw HTTP response */ public HttpResponse rawResponse() { return rawResponse; } - + /** * Returns the headers from the raw HTTP response as a map. - * + * * @return response headers */ public Headers headers() { return new Headers(rawResponse.headers().map()); } - + // present for backwards compatibility public String message() { return getMessage(); } - - public GenAiException withCode(int code) { + + public GaosBaseException withCode(int code) { this.code = code; return this; } - - public GenAiException withBody(@Nullable byte[] body) { + + public GaosBaseException withBody(@Nullable byte[] body) { Utils.checkNotNull(body, "body"); this.body = body; return this; } - - public GenAiException withRawResponse(HttpResponse rawResponse) { + + public GaosBaseException withRawResponse(HttpResponse rawResponse) { Utils.checkNotNull(rawResponse, "rawResponse"); this.rawResponse = rawResponse; return this; } - + @Override public String toString() { - return Utils.toString(this.getClass(), - "requestMethod", rawResponse.request().method(), - "requestUri", rawResponse.request().uri(), - "code", code, - "responseHeaders", rawResponse.headers().map(), - "message", getMessage(), - "body", bodyAsString().orElse("null")); + return Utils.toString( + this.getClass(), + "requestMethod", + rawResponse.request().method(), + "requestUri", + rawResponse.request().uri(), + "code", + code, + "responseHeaders", + rawResponse.headers().map(), + "message", + getMessage(), + "body", + bodyAsString().orElse("null")); } } - diff --git a/src/main/java/com/google/genai/gaos/models/errors/GaosClientException.java b/src/main/java/com/google/genai/gaos/models/errors/GaosClientException.java new file mode 100644 index 00000000000..763a38d9269 --- /dev/null +++ b/src/main/java/com/google/genai/gaos/models/errors/GaosClientException.java @@ -0,0 +1,59 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Injected by scripts/sync_speakeasy_outputs.py DO NOT EDIT. + */ +package com.google.genai.gaos.models.errors; + +import com.google.genai.gaos.utils.Headers; +import com.google.genai.gaos.utils.transport.HttpResponse; +import jakarta.annotation.Nullable; +import java.nio.charset.StandardCharsets; +import java.util.Optional; + +/** + * Carrier base bridging gaos 4xx errors onto the native ClientException hierarchy while + * preserving the gaos body/rawResponse/headers surface. + */ +@SuppressWarnings("serial") +public abstract class GaosClientException extends com.google.genai.errors.ClientException { + + private byte[] body; + private HttpResponse rawResponse; + + public GaosClientException(String message, int code, @Nullable byte[] body, HttpResponse rawResponse, @Nullable Throwable cause) { + super(code, "", message, cause); + this.body = body; + this.rawResponse = rawResponse; + } + + public Optional body() { + return Optional.ofNullable(body); + } + + public Optional bodyAsString() { + return body().map(x -> new String(x, StandardCharsets.UTF_8)); + } + + public HttpResponse rawResponse() { + return rawResponse; + } + + public Headers headers() { + return new Headers(rawResponse.headers().map()); + } +} diff --git a/src/main/java/com/google/genai/gaos/models/errors/GaosServerException.java b/src/main/java/com/google/genai/gaos/models/errors/GaosServerException.java new file mode 100644 index 00000000000..10a64e482da --- /dev/null +++ b/src/main/java/com/google/genai/gaos/models/errors/GaosServerException.java @@ -0,0 +1,59 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Injected by scripts/sync_speakeasy_outputs.py DO NOT EDIT. + */ +package com.google.genai.gaos.models.errors; + +import com.google.genai.gaos.utils.Headers; +import com.google.genai.gaos.utils.transport.HttpResponse; +import jakarta.annotation.Nullable; +import java.nio.charset.StandardCharsets; +import java.util.Optional; + +/** + * Carrier base bridging gaos 5xx errors onto the native ServerException hierarchy while + * preserving the gaos body/rawResponse/headers surface. + */ +@SuppressWarnings("serial") +public abstract class GaosServerException extends com.google.genai.errors.ServerException { + + private byte[] body; + private HttpResponse rawResponse; + + public GaosServerException(String message, int code, @Nullable byte[] body, HttpResponse rawResponse, @Nullable Throwable cause) { + super(code, "", message, cause); + this.body = body; + this.rawResponse = rawResponse; + } + + public Optional body() { + return Optional.ofNullable(body); + } + + public Optional bodyAsString() { + return body().map(x -> new String(x, StandardCharsets.UTF_8)); + } + + public HttpResponse rawResponse() { + return rawResponse; + } + + public Headers headers() { + return new Headers(rawResponse.headers().map()); + } +} diff --git a/src/main/java/com/google/genai/gaos/models/errors/GetInteractionByIdClientError.java b/src/main/java/com/google/genai/gaos/models/errors/GetInteractionByIdClientError.java index bacf864b9ae..1f4fcdd04a1 100644 --- a/src/main/java/com/google/genai/gaos/models/errors/GetInteractionByIdClientError.java +++ b/src/main/java/com/google/genai/gaos/models/errors/GetInteractionByIdClientError.java @@ -35,7 +35,7 @@ import java.util.Optional; @SuppressWarnings("serial") -public class GetInteractionByIdClientError extends GenAiException { +public class GetInteractionByIdClientError extends GaosClientException { @Nullable private final Data data; @@ -44,20 +44,20 @@ public class GetInteractionByIdClientError extends GenAiException { private final Throwable deserializationException; public GetInteractionByIdClientError( - int code, - byte[] body, - HttpResponse rawResponse, - @Nullable Data data, - @Nullable Throwable deserializationException) { + int code, + byte[] body, + HttpResponse rawResponse, + @Nullable Data data, + @Nullable Throwable deserializationException) { super("API error occurred", code, body, rawResponse, null); this.data = data; this.deserializationException = deserializationException; } /** - * Parse a response into an instance of GetInteractionByIdClientError. If deserialization of the response body fails, - * the resulting GetInteractionByIdClientError instance will have a null data() value and a non-null deserializationException(). - */ + * Parse a response into an instance of GetInteractionByIdClientError. If deserialization of the response body fails, + * the resulting GetInteractionByIdClientError instance will have a null data() value and a non-null deserializationException(). + */ public static GetInteractionByIdClientError from(HttpResponse response) { try { byte[] bytes = Utils.extractByteArrayFromBody(response); @@ -88,7 +88,7 @@ public Optional deserializationException() { } /** * Data - * + * *

Error getting interaction */ public static class Data { @@ -99,10 +99,9 @@ public static class Data { private Error error; @JsonCreator - public Data( - @JsonProperty("error") @Nonnull Error error) { - this.error = Optional.ofNullable(error) - .orElseThrow(() -> new IllegalArgumentException("error cannot be null")); + public Data(@JsonProperty("error") @Nonnull Error error) { + this.error = + Optional.ofNullable(error).orElseThrow(() -> new IllegalArgumentException("error cannot be null")); } /** @@ -116,7 +115,6 @@ public static Builder builder() { return new Builder(); } - /** * Error message from an interaction. */ @@ -125,7 +123,6 @@ public Data withError(@Nonnull Error error) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -135,29 +132,26 @@ public boolean equals(java.lang.Object o) { return false; } Data other = (Data) o; - return - Utils.enhancedDeepEquals(this.error, other.error); + return Utils.enhancedDeepEquals(this.error, other.error); } - + @Override public int hashCode() { - return Utils.enhancedHash( - error); + return Utils.enhancedHash(error); } - + @Override public String toString() { - return Utils.toString(Data.class, - "error", error); + return Utils.toString(Data.class, "error", error); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Error error; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -169,12 +163,8 @@ public Builder error(@Nonnull Error error) { } public Data build() { - return new Data( - error); + return new Data(error); } - } } - } - diff --git a/src/main/java/com/google/genai/gaos/models/errors/GetInteractionByIdServerError.java b/src/main/java/com/google/genai/gaos/models/errors/GetInteractionByIdServerError.java index d12f905b974..6dae5d0b32b 100644 --- a/src/main/java/com/google/genai/gaos/models/errors/GetInteractionByIdServerError.java +++ b/src/main/java/com/google/genai/gaos/models/errors/GetInteractionByIdServerError.java @@ -35,7 +35,7 @@ import java.util.Optional; @SuppressWarnings("serial") -public class GetInteractionByIdServerError extends GenAiException { +public class GetInteractionByIdServerError extends GaosServerException { @Nullable private final Data data; @@ -44,20 +44,20 @@ public class GetInteractionByIdServerError extends GenAiException { private final Throwable deserializationException; public GetInteractionByIdServerError( - int code, - byte[] body, - HttpResponse rawResponse, - @Nullable Data data, - @Nullable Throwable deserializationException) { + int code, + byte[] body, + HttpResponse rawResponse, + @Nullable Data data, + @Nullable Throwable deserializationException) { super("API error occurred", code, body, rawResponse, null); this.data = data; this.deserializationException = deserializationException; } /** - * Parse a response into an instance of GetInteractionByIdServerError. If deserialization of the response body fails, - * the resulting GetInteractionByIdServerError instance will have a null data() value and a non-null deserializationException(). - */ + * Parse a response into an instance of GetInteractionByIdServerError. If deserialization of the response body fails, + * the resulting GetInteractionByIdServerError instance will have a null data() value and a non-null deserializationException(). + */ public static GetInteractionByIdServerError from(HttpResponse response) { try { byte[] bytes = Utils.extractByteArrayFromBody(response); @@ -88,7 +88,7 @@ public Optional deserializationException() { } /** * Data - * + * *

Error getting interaction */ public static class Data { @@ -99,10 +99,9 @@ public static class Data { private Error error; @JsonCreator - public Data( - @JsonProperty("error") @Nonnull Error error) { - this.error = Optional.ofNullable(error) - .orElseThrow(() -> new IllegalArgumentException("error cannot be null")); + public Data(@JsonProperty("error") @Nonnull Error error) { + this.error = + Optional.ofNullable(error).orElseThrow(() -> new IllegalArgumentException("error cannot be null")); } /** @@ -116,7 +115,6 @@ public static Builder builder() { return new Builder(); } - /** * Error message from an interaction. */ @@ -125,7 +123,6 @@ public Data withError(@Nonnull Error error) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -135,29 +132,26 @@ public boolean equals(java.lang.Object o) { return false; } Data other = (Data) o; - return - Utils.enhancedDeepEquals(this.error, other.error); + return Utils.enhancedDeepEquals(this.error, other.error); } - + @Override public int hashCode() { - return Utils.enhancedHash( - error); + return Utils.enhancedHash(error); } - + @Override public String toString() { - return Utils.toString(Data.class, - "error", error); + return Utils.toString(Data.class, "error", error); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Error error; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -169,12 +163,8 @@ public Builder error(@Nonnull Error error) { } public Data build() { - return new Data( - error); + return new Data(error); } - } } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/AgentOption.java b/src/main/java/com/google/genai/gaos/models/interactions/AgentOption.java index 938cdc293c8..4323161965d 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/AgentOption.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/AgentOption.java @@ -36,14 +36,16 @@ */ /** * AgentOption - * + * *

The agent to interact with. */ public class AgentOption { - public static final AgentOption DEEP_RESEARCH_PRO_PREVIEW122025 = new AgentOption("deep-research-pro-preview-12-2025"); + public static final AgentOption DEEP_RESEARCH_PRO_PREVIEW122025 = + new AgentOption("deep-research-pro-preview-12-2025"); public static final AgentOption DEEP_RESEARCH_PREVIEW042026 = new AgentOption("deep-research-preview-04-2026"); - public static final AgentOption DEEP_RESEARCH_MAX_PREVIEW042026 = new AgentOption("deep-research-max-preview-04-2026"); + public static final AgentOption DEEP_RESEARCH_MAX_PREVIEW042026 = + new AgentOption("deep-research-max-preview-04-2026"); public static final AgentOption ANTIGRAVITY_PREVIEW052026 = new AgentOption("antigravity-preview-05-2026"); // This map will grow whenever a Color gets created with a new @@ -61,12 +63,12 @@ private AgentOption(String value) { } /** - * Returns a AgentOption with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a AgentOption with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as AgentOption - */ + */ @JsonCreator public static AgentOption of(String value) { synchronized (AgentOption.class) { @@ -94,12 +96,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; AgentOption other = (AgentOption) obj; return Objects.equals(value, other.value); } @@ -133,14 +132,14 @@ private static final Map createEnumsMap() { map.put("antigravity-preview-05-2026", AgentOptionEnum.ANTIGRAVITY_PREVIEW052026); return map; } - - + public enum AgentOptionEnum { DEEP_RESEARCH_PRO_PREVIEW122025("deep-research-pro-preview-12-2025"), DEEP_RESEARCH_PREVIEW042026("deep-research-preview-04-2026"), DEEP_RESEARCH_MAX_PREVIEW042026("deep-research-max-preview-04-2026"), - ANTIGRAVITY_PREVIEW052026("antigravity-preview-05-2026"),; + ANTIGRAVITY_PREVIEW052026("antigravity-preview-05-2026"), + ; private final String value; @@ -153,4 +152,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/AllowedTools.java b/src/main/java/com/google/genai/gaos/models/interactions/AllowedTools.java index 6f56ea9f209..ffa28dce272 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/AllowedTools.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/AllowedTools.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * AllowedTools - * + * *

The configuration for allowed tools. */ public class AllowedTools { @@ -50,12 +50,11 @@ public class AllowedTools { @JsonCreator public AllowedTools( - @JsonProperty("mode") @Nullable ToolChoiceType mode, - @JsonProperty("tools") @Nullable List tools) { + @JsonProperty("mode") @Nullable ToolChoiceType mode, @JsonProperty("tools") @Nullable List tools) { this.mode = mode; this.tools = tools; } - + public AllowedTools() { this(null, null); } @@ -75,13 +74,11 @@ public static Builder builder() { return new Builder(); } - public AllowedTools withMode(@Nullable ToolChoiceType mode) { this.mode = mode; return this; } - /** * The names of the allowed tools. */ @@ -90,7 +87,6 @@ public AllowedTools withTools(@Nullable List tools) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -100,33 +96,28 @@ public boolean equals(java.lang.Object o) { return false; } AllowedTools other = (AllowedTools) o; - return - Utils.enhancedDeepEquals(this.mode, other.mode) && - Utils.enhancedDeepEquals(this.tools, other.tools); + return Utils.enhancedDeepEquals(this.mode, other.mode) && Utils.enhancedDeepEquals(this.tools, other.tools); } - + @Override public int hashCode() { - return Utils.enhancedHash( - mode, tools); + return Utils.enhancedHash(mode, tools); } - + @Override public String toString() { - return Utils.toString(AllowedTools.class, - "mode", mode, - "tools", tools); + return Utils.toString(AllowedTools.class, "mode", mode, "tools", tools); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private ToolChoiceType mode; private List tools; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder mode(@Nullable ToolChoiceType mode) { @@ -143,9 +134,7 @@ public Builder tools(@Nullable List tools) { } public AllowedTools build() { - return new AllowedTools( - mode, tools); + return new AllowedTools(mode, tools); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Allowlist.java b/src/main/java/com/google/genai/gaos/models/interactions/Allowlist.java index 14b17cef90a..eca5a224c5e 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Allowlist.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Allowlist.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * Allowlist - * + * *

Outbound networking configuration for the sandbox. When specified, restricts which external domains * the sandbox can reach. Omit entirely to allow all outbound traffic with no header injection. */ @@ -46,11 +46,10 @@ public class Allowlist { private List allowlist; @JsonCreator - public Allowlist( - @JsonProperty("allowlist") @Nullable List allowlist) { + public Allowlist(@JsonProperty("allowlist") @Nullable List allowlist) { this.allowlist = allowlist; } - + public Allowlist() { this(null); } @@ -67,7 +66,6 @@ public static Builder builder() { return new Builder(); } - /** * List of allowed outbound domains. Only requests to listed domains are permitted. Use [{'domain': * '*'}] to allow all domains while still injecting headers on specific ones. @@ -77,7 +75,6 @@ public Allowlist withAllowlist(@Nullable List allowlist) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -87,29 +84,26 @@ public boolean equals(java.lang.Object o) { return false; } Allowlist other = (Allowlist) o; - return - Utils.enhancedDeepEquals(this.allowlist, other.allowlist); + return Utils.enhancedDeepEquals(this.allowlist, other.allowlist); } - + @Override public int hashCode() { - return Utils.enhancedHash( - allowlist); + return Utils.enhancedHash(allowlist); } - + @Override public String toString() { - return Utils.toString(Allowlist.class, - "allowlist", allowlist); + return Utils.toString(Allowlist.class, "allowlist", allowlist); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List allowlist; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -122,9 +116,7 @@ public Builder allowlist(@Nullable List allowlist) { } public Allowlist build() { - return new Allowlist( - allowlist); + return new Allowlist(allowlist); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/AllowlistEntry.java b/src/main/java/com/google/genai/gaos/models/interactions/AllowlistEntry.java index 37c37b3d2b9..2a1945be486 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/AllowlistEntry.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/AllowlistEntry.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nonnull; @@ -32,13 +32,13 @@ /** * AllowlistEntry - * + * *

A single domain allowlist rule with optional header injection. */ public class AllowlistEntry { /** * Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). - * + * *

Use '*' to allow all domains. */ @JsonProperty("domain") @@ -54,21 +54,19 @@ public class AllowlistEntry { @JsonCreator public AllowlistEntry( - @JsonProperty("domain") @Nonnull String domain, - @JsonProperty("transform") @Nullable Transform transform) { - this.domain = Optional.ofNullable(domain) - .orElseThrow(() -> new IllegalArgumentException("domain cannot be null")); + @JsonProperty("domain") @Nonnull String domain, @JsonProperty("transform") @Nullable Transform transform) { + this.domain = + Optional.ofNullable(domain).orElseThrow(() -> new IllegalArgumentException("domain cannot be null")); this.transform = transform; } - - public AllowlistEntry( - @Nonnull String domain) { + + public AllowlistEntry(@Nonnull String domain) { this(domain, null); } /** * Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). - * + * *

Use '*' to allow all domains. */ public Optional domain() { @@ -87,10 +85,9 @@ public static Builder builder() { return new Builder(); } - /** * Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). - * + * *

Use '*' to allow all domains. */ public AllowlistEntry withDomain(@Nonnull String domain) { @@ -98,7 +95,6 @@ public AllowlistEntry withDomain(@Nonnull String domain) { return this; } - /** * Headers to inject on all outbound requests matching this domain. Accepts a single dict or a list of * dicts. The egress proxy injects these automatically. @@ -108,7 +104,6 @@ public AllowlistEntry withTransform(@Nullable Transform transform) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -118,38 +113,34 @@ public boolean equals(java.lang.Object o) { return false; } AllowlistEntry other = (AllowlistEntry) o; - return - Utils.enhancedDeepEquals(this.domain, other.domain) && - Utils.enhancedDeepEquals(this.transform, other.transform); + return Utils.enhancedDeepEquals(this.domain, other.domain) + && Utils.enhancedDeepEquals(this.transform, other.transform); } - + @Override public int hashCode() { - return Utils.enhancedHash( - domain, transform); + return Utils.enhancedHash(domain, transform); } - + @Override public String toString() { - return Utils.toString(AllowlistEntry.class, - "domain", domain, - "transform", transform); + return Utils.toString(AllowlistEntry.class, "domain", domain, "transform", transform); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String domain; private Transform transform; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** * Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). - * + * *

Use '*' to allow all domains. */ public Builder domain(@Nonnull String domain) { @@ -167,9 +158,7 @@ public Builder transform(@Nullable Transform transform) { } public AllowlistEntry build() { - return new AllowlistEntry( - domain, transform); + return new AllowlistEntry(domain, transform); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Annotation.java b/src/main/java/com/google/genai/gaos/models/interactions/Annotation.java index 3cfe832cd85..5aaa7551f8b 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Annotation.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Annotation.java @@ -19,15 +19,15 @@ */ package com.google.genai.gaos.models.interactions; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; -import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver; import java.lang.String; /** * Annotation - * + * *

Citation information for model-generated content. */ @JsonTypeInfo( @@ -35,12 +35,9 @@ property = "type", include = As.EXISTING_PROPERTY, visible = true, - defaultImpl = UnknownAnnotation.class -) + defaultImpl = UnknownAnnotation.class) @JsonTypeIdResolver(AnnotationTypeIdResolver.class) public interface Annotation { String type(); - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/AnnotationTypeIdResolver.java b/src/main/java/com/google/genai/gaos/models/interactions/AnnotationTypeIdResolver.java index f25c039a672..c4fe05b2a24 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/AnnotationTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/AnnotationTypeIdResolver.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.google.genai.gaos.utils.GenericTypeIdResolver; @@ -26,10 +25,9 @@ import java.lang.Override; import java.lang.String; - /** * AnnotationTypeIdResolver - * + * *

Citation information for model-generated content. */ public class AnnotationTypeIdResolver extends GenericTypeIdResolver { @@ -51,19 +49,19 @@ public String idFromValue(Object value) { if (value == null) { return null; } - + // Handle known types by checking if they implement the discriminator method if (value instanceof Annotation) { Annotation discriminated = (Annotation) value; return discriminated.type(); } - - throw new IllegalArgumentException("Unknown value type: " + value.getClass().getName()); + + throw new IllegalArgumentException( + "Unknown value type: " + value.getClass().getName()); } @Override public String getDescForKnownTypeIds() { return "Annotation type resolver"; } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/AntigravityAgentConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/AntigravityAgentConfig.java index 16ba9119714..f8a814e5fbc 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/AntigravityAgentConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/AntigravityAgentConfig.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -33,7 +33,7 @@ /** * AntigravityAgentConfig - * + * *

Configuration for the Antigravity agent runtime. * Provides server-side control over the agent's execution environment * and tool configuration. @@ -53,7 +53,6 @@ public class AntigravityAgentConfig implements InteractionAgentConfig, CreateAge @JsonProperty("model") private String model; - @JsonProperty("type") private String type; @@ -65,7 +64,7 @@ public AntigravityAgentConfig( this.model = model; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public AntigravityAgentConfig() { this(null, null); } @@ -93,7 +92,6 @@ public static Builder builder() { return new Builder(); } - /** * Max total tokens for the agent run. */ @@ -102,7 +100,6 @@ public AntigravityAgentConfig withMaxTotalTokens(@Nullable String maxTotalTokens return this; } - /** * The model to use for agent reasoning. */ @@ -111,7 +108,6 @@ public AntigravityAgentConfig withModel(@Nullable String model) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -121,35 +117,31 @@ public boolean equals(java.lang.Object o) { return false; } AntigravityAgentConfig other = (AntigravityAgentConfig) o; - return - Utils.enhancedDeepEquals(this.maxTotalTokens, other.maxTotalTokens) && - Utils.enhancedDeepEquals(this.model, other.model) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.maxTotalTokens, other.maxTotalTokens) + && Utils.enhancedDeepEquals(this.model, other.model) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - maxTotalTokens, model, type); + return Utils.enhancedHash(maxTotalTokens, model, type); } - + @Override public String toString() { - return Utils.toString(AntigravityAgentConfig.class, - "maxTotalTokens", maxTotalTokens, - "model", model, - "type", type); + return Utils.toString( + AntigravityAgentConfig.class, "maxTotalTokens", maxTotalTokens, "model", model, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String maxTotalTokens; private String model; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -169,15 +161,10 @@ public Builder model(@Nullable String model) { } public AntigravityAgentConfig build() { - return new AntigravityAgentConfig( - maxTotalTokens, model); + return new AntigravityAgentConfig(maxTotalTokens, model); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"antigravity\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"antigravity\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ArgumentsDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/ArgumentsDelta.java index 10b03a4bf46..f45e84319fd 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ArgumentsDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ArgumentsDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -31,24 +31,21 @@ import java.lang.String; import java.util.Optional; - public class ArgumentsDelta implements StepDeltaData { @JsonInclude(Include.NON_ABSENT) @JsonProperty("arguments") private String arguments; - @JsonProperty("type") private String type; @JsonCreator - public ArgumentsDelta( - @JsonProperty("arguments") @Nullable String arguments) { + public ArgumentsDelta(@JsonProperty("arguments") @Nullable String arguments) { this.arguments = arguments; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public ArgumentsDelta() { this(null); } @@ -66,13 +63,11 @@ public static Builder builder() { return new Builder(); } - public ArgumentsDelta withArguments(@Nullable String arguments) { this.arguments = arguments; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -82,31 +77,27 @@ public boolean equals(java.lang.Object o) { return false; } ArgumentsDelta other = (ArgumentsDelta) o; - return - Utils.enhancedDeepEquals(this.arguments, other.arguments) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.arguments, other.arguments) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - arguments, type); + return Utils.enhancedHash(arguments, type); } - + @Override public String toString() { - return Utils.toString(ArgumentsDelta.class, - "arguments", arguments, - "type", type); + return Utils.toString(ArgumentsDelta.class, "arguments", arguments, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String arguments; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder arguments(@Nullable String arguments) { @@ -115,15 +106,10 @@ public Builder arguments(@Nullable String arguments) { } public ArgumentsDelta build() { - return new ArgumentsDelta( - arguments); + return new ArgumentsDelta(arguments); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"arguments_delta\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"arguments_delta\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/AudioContent.java b/src/main/java/com/google/genai/gaos/models/interactions/AudioContent.java index bba50dc9be3..ee012fe2ced 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/AudioContent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/AudioContent.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * AudioContent - * + * *

An audio content block. */ public class AudioContent implements Content { @@ -59,7 +59,6 @@ public class AudioContent implements Content { @JsonProperty("sample_rate") private Integer sampleRate; - @JsonProperty("type") private String type; @@ -91,10 +90,9 @@ public AudioContent( this.uri = uri; this.mimeType = mimeType; } - + public AudioContent() { - this(null, null, null, - null, null); + this(null, null, null, null, null); } /** @@ -141,7 +139,6 @@ public static Builder builder() { return new Builder(); } - /** * The number of audio channels. */ @@ -150,7 +147,6 @@ public AudioContent withChannels(@Nullable Integer channels) { return this; } - /** * The audio content. */ @@ -159,7 +155,6 @@ public AudioContent withData(@Nullable String data) { return this; } - /** * The sample rate of the audio. */ @@ -168,7 +163,6 @@ public AudioContent withSampleRate(@Nullable Integer sampleRate) { return this; } - /** * The URI of the audio. */ @@ -177,7 +171,6 @@ public AudioContent withUri(@Nullable String uri) { return this; } - /** * The mime type of the audio. */ @@ -186,7 +179,6 @@ public AudioContent withMimeType(@Nullable AudioContentMimeType mimeType) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -196,35 +188,39 @@ public boolean equals(java.lang.Object o) { return false; } AudioContent other = (AudioContent) o; - return - Utils.enhancedDeepEquals(this.channels, other.channels) && - Utils.enhancedDeepEquals(this.data, other.data) && - Utils.enhancedDeepEquals(this.sampleRate, other.sampleRate) && - Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.uri, other.uri) && - Utils.enhancedDeepEquals(this.mimeType, other.mimeType); + return Utils.enhancedDeepEquals(this.channels, other.channels) + && Utils.enhancedDeepEquals(this.data, other.data) + && Utils.enhancedDeepEquals(this.sampleRate, other.sampleRate) + && Utils.enhancedDeepEquals(this.type, other.type) + && Utils.enhancedDeepEquals(this.uri, other.uri) + && Utils.enhancedDeepEquals(this.mimeType, other.mimeType); } - + @Override public int hashCode() { - return Utils.enhancedHash( - channels, data, sampleRate, - type, uri, mimeType); + return Utils.enhancedHash(channels, data, sampleRate, type, uri, mimeType); } - + @Override public String toString() { - return Utils.toString(AudioContent.class, - "channels", channels, - "data", data, - "sampleRate", sampleRate, - "type", type, - "uri", uri, - "mimeType", mimeType); + return Utils.toString( + AudioContent.class, + "channels", + channels, + "data", + data, + "sampleRate", + sampleRate, + "type", + type, + "uri", + uri, + "mimeType", + mimeType); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Integer channels; @@ -237,7 +233,7 @@ public final static class Builder { private AudioContentMimeType mimeType; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -281,16 +277,10 @@ public Builder mimeType(@Nullable AudioContentMimeType mimeType) { } public AudioContent build() { - return new AudioContent( - channels, data, sampleRate, - uri, mimeType); + return new AudioContent(channels, data, sampleRate, uri, mimeType); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"audio\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"audio\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/AudioContentMimeType.java b/src/main/java/com/google/genai/gaos/models/interactions/AudioContentMimeType.java index 7f788b49487..658e66f8ca4 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/AudioContentMimeType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/AudioContentMimeType.java @@ -36,7 +36,7 @@ */ /** * AudioContentMimeType - * + * *

The mime type of the audio. */ public class AudioContentMimeType { @@ -69,12 +69,12 @@ private AudioContentMimeType(String value) { } /** - * Returns a AudioContentMimeType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a AudioContentMimeType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as AudioContentMimeType - */ + */ @JsonCreator public static AudioContentMimeType of(String value) { synchronized (AudioContentMimeType.class) { @@ -102,12 +102,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; AudioContentMimeType other = (AudioContentMimeType) obj; return Objects.equals(value, other.value); } @@ -157,8 +154,7 @@ private static final Map createEnumsMap() { map.put("audio/mulaw", AudioContentMimeTypeEnum.AUDIO_MULAW); return map; } - - + public enum AudioContentMimeTypeEnum { AUDIO_WAV("audio/wav"), @@ -172,7 +168,8 @@ public enum AudioContentMimeTypeEnum { AUDIO_L16("audio/l16"), AUDIO_OPUS("audio/opus"), AUDIO_ALAW("audio/alaw"), - AUDIO_MULAW("audio/mulaw"),; + AUDIO_MULAW("audio/mulaw"), + ; private final String value; @@ -185,4 +182,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/AudioDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/AudioDelta.java index 30defe454ab..8f3d3a1ddc9 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/AudioDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/AudioDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -33,7 +33,6 @@ import java.lang.String; import java.util.Optional; - public class AudioDelta implements StepDeltaData { /** * The number of audio channels. @@ -42,19 +41,17 @@ public class AudioDelta implements StepDeltaData { @JsonProperty("channels") private Integer channels; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("data") private String data; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("mime_type") private AudioDeltaMimeType mimeType; /** * Deprecated. Use sample_rate instead. The value is ignored. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -69,11 +66,9 @@ public class AudioDelta implements StepDeltaData { @JsonProperty("sample_rate") private Integer sampleRate; - @JsonProperty("type") private String type; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("uri") private String uri; @@ -94,10 +89,9 @@ public AudioDelta( this.type = Builder._SINGLETON_VALUE_Type.value(); this.uri = uri; } - + public AudioDelta() { - this(null, null, null, - null, null, null); + this(null, null, null, null, null, null); } /** @@ -117,7 +111,7 @@ public Optional mimeType() { /** * Deprecated. Use sample_rate instead. The value is ignored. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -145,7 +139,6 @@ public static Builder builder() { return new Builder(); } - /** * The number of audio channels. */ @@ -154,22 +147,19 @@ public AudioDelta withChannels(@Nullable Integer channels) { return this; } - public AudioDelta withData(@Nullable String data) { this.data = data; return this; } - public AudioDelta withMimeType(@Nullable AudioDeltaMimeType mimeType) { this.mimeType = mimeType; return this; } - /** * Deprecated. Use sample_rate instead. The value is ignored. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -178,7 +168,6 @@ public AudioDelta withRate(@Nullable Integer rate) { return this; } - /** * The sample rate of the audio. */ @@ -187,13 +176,11 @@ public AudioDelta withSampleRate(@Nullable Integer sampleRate) { return this; } - public AudioDelta withUri(@Nullable String uri) { this.uri = uri; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -203,38 +190,42 @@ public boolean equals(java.lang.Object o) { return false; } AudioDelta other = (AudioDelta) o; - return - Utils.enhancedDeepEquals(this.channels, other.channels) && - Utils.enhancedDeepEquals(this.data, other.data) && - Utils.enhancedDeepEquals(this.mimeType, other.mimeType) && - Utils.enhancedDeepEquals(this.rate, other.rate) && - Utils.enhancedDeepEquals(this.sampleRate, other.sampleRate) && - Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.uri, other.uri); + return Utils.enhancedDeepEquals(this.channels, other.channels) + && Utils.enhancedDeepEquals(this.data, other.data) + && Utils.enhancedDeepEquals(this.mimeType, other.mimeType) + && Utils.enhancedDeepEquals(this.rate, other.rate) + && Utils.enhancedDeepEquals(this.sampleRate, other.sampleRate) + && Utils.enhancedDeepEquals(this.type, other.type) + && Utils.enhancedDeepEquals(this.uri, other.uri); } - + @Override public int hashCode() { - return Utils.enhancedHash( - channels, data, mimeType, - rate, sampleRate, type, - uri); + return Utils.enhancedHash(channels, data, mimeType, rate, sampleRate, type, uri); } - + @Override public String toString() { - return Utils.toString(AudioDelta.class, - "channels", channels, - "data", data, - "mimeType", mimeType, - "rate", rate, - "sampleRate", sampleRate, - "type", type, - "uri", uri); + return Utils.toString( + AudioDelta.class, + "channels", + channels, + "data", + data, + "mimeType", + mimeType, + "rate", + rate, + "sampleRate", + sampleRate, + "type", + type, + "uri", + uri); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Integer channels; @@ -250,7 +241,7 @@ public final static class Builder { private String uri; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -273,7 +264,7 @@ public Builder mimeType(@Nullable AudioDeltaMimeType mimeType) { /** * Deprecated. Use sample_rate instead. The value is ignored. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -296,16 +287,10 @@ public Builder uri(@Nullable String uri) { } public AudioDelta build() { - return new AudioDelta( - channels, data, mimeType, - rate, sampleRate, uri); + return new AudioDelta(channels, data, mimeType, rate, sampleRate, uri); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"audio\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"audio\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/AudioDeltaMimeType.java b/src/main/java/com/google/genai/gaos/models/interactions/AudioDeltaMimeType.java index 863a03e7b8e..9e38725a586 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/AudioDeltaMimeType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/AudioDeltaMimeType.java @@ -64,12 +64,12 @@ private AudioDeltaMimeType(String value) { } /** - * Returns a AudioDeltaMimeType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a AudioDeltaMimeType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as AudioDeltaMimeType - */ + */ @JsonCreator public static AudioDeltaMimeType of(String value) { synchronized (AudioDeltaMimeType.class) { @@ -97,12 +97,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; AudioDeltaMimeType other = (AudioDeltaMimeType) obj; return Objects.equals(value, other.value); } @@ -152,8 +149,7 @@ private static final Map createEnumsMap() { map.put("audio/mulaw", AudioDeltaMimeTypeEnum.AUDIO_MULAW); return map; } - - + public enum AudioDeltaMimeTypeEnum { AUDIO_WAV("audio/wav"), @@ -167,7 +163,8 @@ public enum AudioDeltaMimeTypeEnum { AUDIO_L16("audio/l16"), AUDIO_OPUS("audio/opus"), AUDIO_ALAW("audio/alaw"), - AUDIO_MULAW("audio/mulaw"),; + AUDIO_MULAW("audio/mulaw"), + ; private final String value; @@ -180,4 +177,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/AudioResponseFormat.java b/src/main/java/com/google/genai/gaos/models/interactions/AudioResponseFormat.java index d42f3a0c89f..bb9e6eb9c02 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/AudioResponseFormat.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/AudioResponseFormat.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * AudioResponseFormat - * + * *

Configuration for audio output format. */ public class AudioResponseFormat { @@ -67,7 +67,6 @@ public class AudioResponseFormat { @JsonProperty("sample_rate") private Integer sampleRate; - @JsonProperty("type") private String type; @@ -83,10 +82,9 @@ public AudioResponseFormat( this.sampleRate = sampleRate; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public AudioResponseFormat() { - this(null, null, null, - null); + this(null, null, null, null); } /** @@ -126,7 +124,6 @@ public static Builder builder() { return new Builder(); } - /** * Bit rate in bits per second (bps). Only applicable for compressed formats * (MP3, Opus). @@ -136,7 +133,6 @@ public AudioResponseFormat withBitRate(@Nullable Integer bitRate) { return this; } - /** * The delivery mode for the audio output. */ @@ -145,7 +141,6 @@ public AudioResponseFormat withDelivery(@Nullable AudioResponseFormatDelivery de return this; } - /** * The MIME type of the audio output. */ @@ -154,7 +149,6 @@ public AudioResponseFormat withMimeType(@Nullable AudioResponseFormatMimeType mi return this; } - /** * Sample rate in Hz. */ @@ -163,7 +157,6 @@ public AudioResponseFormat withSampleRate(@Nullable Integer sampleRate) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -173,33 +166,36 @@ public boolean equals(java.lang.Object o) { return false; } AudioResponseFormat other = (AudioResponseFormat) o; - return - Utils.enhancedDeepEquals(this.bitRate, other.bitRate) && - Utils.enhancedDeepEquals(this.delivery, other.delivery) && - Utils.enhancedDeepEquals(this.mimeType, other.mimeType) && - Utils.enhancedDeepEquals(this.sampleRate, other.sampleRate) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.bitRate, other.bitRate) + && Utils.enhancedDeepEquals(this.delivery, other.delivery) + && Utils.enhancedDeepEquals(this.mimeType, other.mimeType) + && Utils.enhancedDeepEquals(this.sampleRate, other.sampleRate) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - bitRate, delivery, mimeType, - sampleRate, type); + return Utils.enhancedHash(bitRate, delivery, mimeType, sampleRate, type); } - + @Override public String toString() { - return Utils.toString(AudioResponseFormat.class, - "bitRate", bitRate, - "delivery", delivery, - "mimeType", mimeType, - "sampleRate", sampleRate, - "type", type); + return Utils.toString( + AudioResponseFormat.class, + "bitRate", + bitRate, + "delivery", + delivery, + "mimeType", + mimeType, + "sampleRate", + sampleRate, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Integer bitRate; @@ -210,7 +206,7 @@ public final static class Builder { private Integer sampleRate; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -247,16 +243,10 @@ public Builder sampleRate(@Nullable Integer sampleRate) { } public AudioResponseFormat build() { - return new AudioResponseFormat( - bitRate, delivery, mimeType, - sampleRate); + return new AudioResponseFormat(bitRate, delivery, mimeType, sampleRate); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"audio\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"audio\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/AudioResponseFormatDelivery.java b/src/main/java/com/google/genai/gaos/models/interactions/AudioResponseFormatDelivery.java index 13e4780ec21..d3497956784 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/AudioResponseFormatDelivery.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/AudioResponseFormatDelivery.java @@ -36,7 +36,7 @@ */ /** * AudioResponseFormatDelivery - * + * *

The delivery mode for the audio output. */ public class AudioResponseFormatDelivery { @@ -59,12 +59,12 @@ private AudioResponseFormatDelivery(String value) { } /** - * Returns a AudioResponseFormatDelivery with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a AudioResponseFormatDelivery with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as AudioResponseFormatDelivery - */ + */ @JsonCreator public static AudioResponseFormatDelivery of(String value) { synchronized (AudioResponseFormatDelivery.class) { @@ -92,12 +92,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; AudioResponseFormatDelivery other = (AudioResponseFormatDelivery) obj; return Objects.equals(value, other.value); } @@ -127,12 +124,12 @@ private static final Map createEnumsMap map.put("uri", AudioResponseFormatDeliveryEnum.URI); return map; } - - + public enum AudioResponseFormatDeliveryEnum { INLINE("inline"), - URI("uri"),; + URI("uri"), + ; private final String value; @@ -145,4 +142,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/AudioResponseFormatMimeType.java b/src/main/java/com/google/genai/gaos/models/interactions/AudioResponseFormatMimeType.java index df96557a80d..208d73dc195 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/AudioResponseFormatMimeType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/AudioResponseFormatMimeType.java @@ -36,7 +36,7 @@ */ /** * AudioResponseFormatMimeType - * + * *

The MIME type of the audio output. */ public class AudioResponseFormatMimeType { @@ -63,12 +63,12 @@ private AudioResponseFormatMimeType(String value) { } /** - * Returns a AudioResponseFormatMimeType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a AudioResponseFormatMimeType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as AudioResponseFormatMimeType - */ + */ @JsonCreator public static AudioResponseFormatMimeType of(String value) { synchronized (AudioResponseFormatMimeType.class) { @@ -96,12 +96,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; AudioResponseFormatMimeType other = (AudioResponseFormatMimeType) obj; return Objects.equals(value, other.value); } @@ -139,8 +136,7 @@ private static final Map createEnumsMap map.put("audio/mulaw", AudioResponseFormatMimeTypeEnum.AUDIO_MULAW); return map; } - - + public enum AudioResponseFormatMimeTypeEnum { AUDIO_MP3("audio/mp3"), @@ -148,7 +144,8 @@ public enum AudioResponseFormatMimeTypeEnum { AUDIO_L16("audio/l16"), AUDIO_WAV("audio/wav"), AUDIO_ALAW("audio/alaw"), - AUDIO_MULAW("audio/mulaw"),; + AUDIO_MULAW("audio/mulaw"), + ; private final String value; @@ -161,4 +158,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CodeExecution.java b/src/main/java/com/google/genai/gaos/models/interactions/CodeExecution.java index 6e3ce7ad03e..71765fa3206 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CodeExecution.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CodeExecution.java @@ -30,7 +30,7 @@ /** * CodeExecution - * + * *

A tool that can be used by the model to execute code. */ public class CodeExecution implements Tool, AgentTool { @@ -52,7 +52,6 @@ public static Builder builder() { return new Builder(); } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -62,39 +61,31 @@ public boolean equals(java.lang.Object o) { return false; } CodeExecution other = (CodeExecution) o; - return - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - type); + return Utils.enhancedHash(type); } - + @Override public String toString() { - return Utils.toString(CodeExecution.class, - "type", type); + return Utils.toString(CodeExecution.class, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Builder() { - // force use of static builder() method + // force use of static builder() method } public CodeExecution build() { - return new CodeExecution( - ); + return new CodeExecution(); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"code_execution\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"code_execution\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionCallArguments.java b/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionCallArguments.java index 9afba310355..1161f91b07a 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionCallArguments.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionCallArguments.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -31,7 +31,7 @@ /** * CodeExecutionCallArguments - * + * *

The arguments to pass to the code execution. */ public class CodeExecutionCallArguments { @@ -51,12 +51,11 @@ public class CodeExecutionCallArguments { @JsonCreator public CodeExecutionCallArguments( - @JsonProperty("code") @Nullable String code, - @JsonProperty("language") @Nullable Language language) { + @JsonProperty("code") @Nullable String code, @JsonProperty("language") @Nullable Language language) { this.code = code; this.language = language; } - + public CodeExecutionCallArguments() { this(null, null); } @@ -79,7 +78,6 @@ public static Builder builder() { return new Builder(); } - /** * The code to be executed. */ @@ -88,7 +86,6 @@ public CodeExecutionCallArguments withCode(@Nullable String code) { return this; } - /** * Programming language of the `code`. */ @@ -97,7 +94,6 @@ public CodeExecutionCallArguments withLanguage(@Nullable Language language) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -107,33 +103,28 @@ public boolean equals(java.lang.Object o) { return false; } CodeExecutionCallArguments other = (CodeExecutionCallArguments) o; - return - Utils.enhancedDeepEquals(this.code, other.code) && - Utils.enhancedDeepEquals(this.language, other.language); + return Utils.enhancedDeepEquals(this.code, other.code) && Utils.enhancedDeepEquals(this.language, other.language); } - + @Override public int hashCode() { - return Utils.enhancedHash( - code, language); + return Utils.enhancedHash(code, language); } - + @Override public String toString() { - return Utils.toString(CodeExecutionCallArguments.class, - "code", code, - "language", language); + return Utils.toString(CodeExecutionCallArguments.class, "code", code, "language", language); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String code; private Language language; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -153,9 +144,7 @@ public Builder language(@Nullable Language language) { } public CodeExecutionCallArguments build() { - return new CodeExecutionCallArguments( - code, language); + return new CodeExecutionCallArguments(code, language); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionCallDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionCallDelta.java index e91ca3e7f2e..2ab47603967 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionCallDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionCallDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -32,7 +32,6 @@ import java.lang.String; import java.util.Optional; - public class CodeExecutionCallDelta implements StepDeltaData { /** * The arguments to pass to the code execution. @@ -47,7 +46,6 @@ public class CodeExecutionCallDelta implements StepDeltaData { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -56,13 +54,12 @@ public CodeExecutionCallDelta( @JsonProperty("arguments") @Nonnull CodeExecutionCallArguments arguments, @JsonProperty("signature") @Nullable String signature) { this.arguments = Optional.ofNullable(arguments) - .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public CodeExecutionCallDelta( - @Nonnull CodeExecutionCallArguments arguments) { + + public CodeExecutionCallDelta(@Nonnull CodeExecutionCallArguments arguments) { this(arguments, null); } @@ -89,7 +86,6 @@ public static Builder builder() { return new Builder(); } - /** * The arguments to pass to the code execution. */ @@ -98,7 +94,6 @@ public CodeExecutionCallDelta withArguments(@Nonnull CodeExecutionCallArguments return this; } - /** * A signature hash for backend validation. */ @@ -107,7 +102,6 @@ public CodeExecutionCallDelta withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -117,35 +111,31 @@ public boolean equals(java.lang.Object o) { return false; } CodeExecutionCallDelta other = (CodeExecutionCallDelta) o; - return - Utils.enhancedDeepEquals(this.arguments, other.arguments) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.arguments, other.arguments) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - arguments, signature, type); + return Utils.enhancedHash(arguments, signature, type); } - + @Override public String toString() { - return Utils.toString(CodeExecutionCallDelta.class, - "arguments", arguments, - "signature", signature, - "type", type); + return Utils.toString( + CodeExecutionCallDelta.class, "arguments", arguments, "signature", signature, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private CodeExecutionCallArguments arguments; private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -165,15 +155,10 @@ public Builder signature(@Nullable String signature) { } public CodeExecutionCallDelta build() { - return new CodeExecutionCallDelta( - arguments, signature); + return new CodeExecutionCallDelta(arguments, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"code_execution_call\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"code_execution_call\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionCallStep.java b/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionCallStep.java index 2821b01e8f6..412a5c91fa9 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionCallStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionCallStep.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * CodeExecutionCallStep - * + * *

Code execution call step. */ public class CodeExecutionCallStep implements Step { @@ -57,7 +57,6 @@ public class CodeExecutionCallStep implements Step { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -67,16 +66,13 @@ public CodeExecutionCallStep( @JsonProperty("id") @Nonnull String id, @JsonProperty("signature") @Nullable String signature) { this.arguments = Optional.ofNullable(arguments) - .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public CodeExecutionCallStep( - @Nonnull CodeExecutionCallArguments arguments, - @Nonnull String id) { + + public CodeExecutionCallStep(@Nonnull CodeExecutionCallArguments arguments, @Nonnull String id) { this(arguments, id, null); } @@ -110,7 +106,6 @@ public static Builder builder() { return new Builder(); } - /** * The arguments to pass to the code execution. */ @@ -119,7 +114,6 @@ public CodeExecutionCallStep withArguments(@Nonnull CodeExecutionCallArguments a return this; } - /** * Required. A unique ID for this specific tool call. */ @@ -128,7 +122,6 @@ public CodeExecutionCallStep withId(@Nonnull String id) { return this; } - /** * A signature hash for backend validation. */ @@ -137,7 +130,6 @@ public CodeExecutionCallStep withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -147,31 +139,25 @@ public boolean equals(java.lang.Object o) { return false; } CodeExecutionCallStep other = (CodeExecutionCallStep) o; - return - Utils.enhancedDeepEquals(this.arguments, other.arguments) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.arguments, other.arguments) + && Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - arguments, id, signature, - type); + return Utils.enhancedHash(arguments, id, signature, type); } - + @Override public String toString() { - return Utils.toString(CodeExecutionCallStep.class, - "arguments", arguments, - "id", id, - "signature", signature, - "type", type); + return Utils.toString( + CodeExecutionCallStep.class, "arguments", arguments, "id", id, "signature", signature, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private CodeExecutionCallArguments arguments; @@ -180,7 +166,7 @@ public final static class Builder { private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -208,15 +194,10 @@ public Builder signature(@Nullable String signature) { } public CodeExecutionCallStep build() { - return new CodeExecutionCallStep( - arguments, id, signature); + return new CodeExecutionCallStep(arguments, id, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"code_execution_call\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"code_execution_call\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionResultDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionResultDelta.java index 0ebdf0a7447..fa942233774 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionResultDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionResultDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -33,14 +33,12 @@ import java.lang.String; import java.util.Optional; - public class CodeExecutionResultDelta implements StepDeltaData { @JsonInclude(Include.NON_ABSENT) @JsonProperty("is_error") private Boolean isError; - @JsonProperty("result") private String result; @@ -51,7 +49,6 @@ public class CodeExecutionResultDelta implements StepDeltaData { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -61,14 +58,13 @@ public CodeExecutionResultDelta( @JsonProperty("result") @Nonnull String result, @JsonProperty("signature") @Nullable String signature) { this.isError = isError; - this.result = Optional.ofNullable(result) - .orElseThrow(() -> new IllegalArgumentException("result cannot be null")); + this.result = + Optional.ofNullable(result).orElseThrow(() -> new IllegalArgumentException("result cannot be null")); this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public CodeExecutionResultDelta( - @Nonnull String result) { + + public CodeExecutionResultDelta(@Nonnull String result) { this(null, result, null); } @@ -96,19 +92,16 @@ public static Builder builder() { return new Builder(); } - public CodeExecutionResultDelta withIsError(@Nullable Boolean isError) { this.isError = isError; return this; } - public CodeExecutionResultDelta withResult(@Nonnull String result) { this.result = Utils.checkNotNull(result, "result"); return this; } - /** * A signature hash for backend validation. */ @@ -117,7 +110,6 @@ public CodeExecutionResultDelta withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -127,31 +119,33 @@ public boolean equals(java.lang.Object o) { return false; } CodeExecutionResultDelta other = (CodeExecutionResultDelta) o; - return - Utils.enhancedDeepEquals(this.isError, other.isError) && - Utils.enhancedDeepEquals(this.result, other.result) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.isError, other.isError) + && Utils.enhancedDeepEquals(this.result, other.result) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - isError, result, signature, - type); + return Utils.enhancedHash(isError, result, signature, type); } - + @Override public String toString() { - return Utils.toString(CodeExecutionResultDelta.class, - "isError", isError, - "result", result, - "signature", signature, - "type", type); + return Utils.toString( + CodeExecutionResultDelta.class, + "isError", + isError, + "result", + result, + "signature", + signature, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Boolean isError; @@ -160,7 +154,7 @@ public final static class Builder { private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder isError(@Nullable Boolean isError) { @@ -182,15 +176,10 @@ public Builder signature(@Nullable String signature) { } public CodeExecutionResultDelta build() { - return new CodeExecutionResultDelta( - isError, result, signature); + return new CodeExecutionResultDelta(isError, result, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"code_execution_result\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"code_execution_result\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionResultStep.java b/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionResultStep.java index 954d0c03076..b43f1472ee4 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionResultStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CodeExecutionResultStep.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -35,7 +35,7 @@ /** * CodeExecutionResultStep - * + * *

Code execution result step. */ public class CodeExecutionResultStep implements Step { @@ -65,7 +65,6 @@ public class CodeExecutionResultStep implements Step { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -75,20 +74,17 @@ public CodeExecutionResultStep( @JsonProperty("is_error") @Nullable Boolean isError, @JsonProperty("result") @Nonnull String result, @JsonProperty("signature") @Nullable String signature) { - this.callId = Optional.ofNullable(callId) - .orElseThrow(() -> new IllegalArgumentException("callId cannot be null")); + this.callId = + Optional.ofNullable(callId).orElseThrow(() -> new IllegalArgumentException("callId cannot be null")); this.isError = isError; - this.result = Optional.ofNullable(result) - .orElseThrow(() -> new IllegalArgumentException("result cannot be null")); + this.result = + Optional.ofNullable(result).orElseThrow(() -> new IllegalArgumentException("result cannot be null")); this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public CodeExecutionResultStep( - @Nonnull String callId, - @Nonnull String result) { - this(callId, null, result, - null); + + public CodeExecutionResultStep(@Nonnull String callId, @Nonnull String result) { + this(callId, null, result, null); } /** @@ -128,7 +124,6 @@ public static Builder builder() { return new Builder(); } - /** * Required. ID to match the ID from the function call block. */ @@ -137,7 +132,6 @@ public CodeExecutionResultStep withCallId(@Nonnull String callId) { return this; } - /** * Whether the code execution resulted in an error. */ @@ -146,7 +140,6 @@ public CodeExecutionResultStep withIsError(@Nullable Boolean isError) { return this; } - /** * Required. The output of the code execution. */ @@ -155,7 +148,6 @@ public CodeExecutionResultStep withResult(@Nonnull String result) { return this; } - /** * A signature hash for backend validation. */ @@ -164,7 +156,6 @@ public CodeExecutionResultStep withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -174,33 +165,36 @@ public boolean equals(java.lang.Object o) { return false; } CodeExecutionResultStep other = (CodeExecutionResultStep) o; - return - Utils.enhancedDeepEquals(this.callId, other.callId) && - Utils.enhancedDeepEquals(this.isError, other.isError) && - Utils.enhancedDeepEquals(this.result, other.result) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.callId, other.callId) + && Utils.enhancedDeepEquals(this.isError, other.isError) + && Utils.enhancedDeepEquals(this.result, other.result) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - callId, isError, result, - signature, type); + return Utils.enhancedHash(callId, isError, result, signature, type); } - + @Override public String toString() { - return Utils.toString(CodeExecutionResultStep.class, - "callId", callId, - "isError", isError, - "result", result, - "signature", signature, - "type", type); + return Utils.toString( + CodeExecutionResultStep.class, + "callId", + callId, + "isError", + isError, + "result", + result, + "signature", + signature, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String callId; @@ -211,7 +205,7 @@ public final static class Builder { private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -247,16 +241,10 @@ public Builder signature(@Nullable String signature) { } public CodeExecutionResultStep build() { - return new CodeExecutionResultStep( - callId, isError, result, - signature); + return new CodeExecutionResultStep(callId, isError, result, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"code_execution_result\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"code_execution_result\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CodeMenderAgentConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/CodeMenderAgentConfig.java index 451d000c8c6..b7396630e55 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CodeMenderAgentConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CodeMenderAgentConfig.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -33,7 +33,7 @@ /** * CodeMenderAgentConfig - * + * *

Configuration for the CodeMender agent. */ public class CodeMenderAgentConfig implements InteractionAgentConfig, CreateAgentInteractionAgentConfig { @@ -76,7 +76,6 @@ public class CodeMenderAgentConfig implements InteractionAgentConfig, CreateAgen @JsonProperty("session_id") private String sessionId; - @JsonProperty("type") private String type; @@ -94,10 +93,9 @@ public CodeMenderAgentConfig( this.sessionId = sessionId; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public CodeMenderAgentConfig() { - this(null, null, null, - null, null); + this(null, null, null, null, null); } /** @@ -148,7 +146,6 @@ public static Builder builder() { return new Builder(); } - /** * Request parameters specific to FIND sessions, used for discovering * vulnerabilities in a codebase. @@ -158,7 +155,6 @@ public CodeMenderAgentConfig withFindRequest(@Nullable FindRequest findRequest) return this; } - /** * Request parameters specific to FIX sessions, used for generating and * validating security patches. @@ -168,7 +164,6 @@ public CodeMenderAgentConfig withFixRequest(@Nullable FixRequest fixRequest) { return this; } - /** * The name of the model to use for the CodeMender agent. One * CodeMender session will only use one model. @@ -178,7 +173,6 @@ public CodeMenderAgentConfig withModel(@Nullable String model) { return this; } - /** * The configuration of CodeMender sessions. */ @@ -187,7 +181,6 @@ public CodeMenderAgentConfig withSessionConfig(@Nullable SessionConfig sessionCo return this; } - /** * Parameter for grouping multiple interactions that belong to * the same CodeMender session. @@ -197,7 +190,6 @@ public CodeMenderAgentConfig withSessionId(@Nullable String sessionId) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -207,35 +199,39 @@ public boolean equals(java.lang.Object o) { return false; } CodeMenderAgentConfig other = (CodeMenderAgentConfig) o; - return - Utils.enhancedDeepEquals(this.findRequest, other.findRequest) && - Utils.enhancedDeepEquals(this.fixRequest, other.fixRequest) && - Utils.enhancedDeepEquals(this.model, other.model) && - Utils.enhancedDeepEquals(this.sessionConfig, other.sessionConfig) && - Utils.enhancedDeepEquals(this.sessionId, other.sessionId) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.findRequest, other.findRequest) + && Utils.enhancedDeepEquals(this.fixRequest, other.fixRequest) + && Utils.enhancedDeepEquals(this.model, other.model) + && Utils.enhancedDeepEquals(this.sessionConfig, other.sessionConfig) + && Utils.enhancedDeepEquals(this.sessionId, other.sessionId) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - findRequest, fixRequest, model, - sessionConfig, sessionId, type); + return Utils.enhancedHash(findRequest, fixRequest, model, sessionConfig, sessionId, type); } - + @Override public String toString() { - return Utils.toString(CodeMenderAgentConfig.class, - "findRequest", findRequest, - "fixRequest", fixRequest, - "model", model, - "sessionConfig", sessionConfig, - "sessionId", sessionId, - "type", type); + return Utils.toString( + CodeMenderAgentConfig.class, + "findRequest", + findRequest, + "fixRequest", + fixRequest, + "model", + model, + "sessionConfig", + sessionConfig, + "sessionId", + sessionId, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private FindRequest findRequest; @@ -248,7 +244,7 @@ public final static class Builder { private String sessionId; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -296,16 +292,10 @@ public Builder sessionId(@Nullable String sessionId) { } public CodeMenderAgentConfig build() { - return new CodeMenderAgentConfig( - findRequest, fixRequest, model, - sessionConfig, sessionId); + return new CodeMenderAgentConfig(findRequest, fixRequest, model, sessionConfig, sessionId); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"code-mender\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"code-mender\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ComputerUse.java b/src/main/java/com/google/genai/gaos/models/interactions/ComputerUse.java index f084711d6ec..fad6b27f1c3 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ComputerUse.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ComputerUse.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -35,7 +35,7 @@ /** * ComputerUse - * + * *

A tool that can be used by the model to interact with the computer. */ public class ComputerUse implements Tool { @@ -68,7 +68,6 @@ public class ComputerUse implements Tool { @JsonProperty("excluded_predefined_functions") private List excludedPredefinedFunctions; - @JsonProperty("type") private String type; @@ -84,10 +83,9 @@ public ComputerUse( this.excludedPredefinedFunctions = excludedPredefinedFunctions; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public ComputerUse() { - this(null, null, null, - null); + this(null, null, null, null); } /** @@ -128,7 +126,6 @@ public static Builder builder() { return new Builder(); } - /** * Optional. Disabled safety policies for computer use. */ @@ -137,7 +134,6 @@ public ComputerUse withDisabledSafetyPolicies(@Nullable List exclud return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -175,33 +168,37 @@ public boolean equals(java.lang.Object o) { return false; } ComputerUse other = (ComputerUse) o; - return - Utils.enhancedDeepEquals(this.disabledSafetyPolicies, other.disabledSafetyPolicies) && - Utils.enhancedDeepEquals(this.enablePromptInjectionDetection, other.enablePromptInjectionDetection) && - Utils.enhancedDeepEquals(this.environment, other.environment) && - Utils.enhancedDeepEquals(this.excludedPredefinedFunctions, other.excludedPredefinedFunctions) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.disabledSafetyPolicies, other.disabledSafetyPolicies) + && Utils.enhancedDeepEquals(this.enablePromptInjectionDetection, other.enablePromptInjectionDetection) + && Utils.enhancedDeepEquals(this.environment, other.environment) + && Utils.enhancedDeepEquals(this.excludedPredefinedFunctions, other.excludedPredefinedFunctions) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { return Utils.enhancedHash( - disabledSafetyPolicies, enablePromptInjectionDetection, environment, - excludedPredefinedFunctions, type); + disabledSafetyPolicies, enablePromptInjectionDetection, environment, excludedPredefinedFunctions, type); } - + @Override public String toString() { - return Utils.toString(ComputerUse.class, - "disabledSafetyPolicies", disabledSafetyPolicies, - "enablePromptInjectionDetection", enablePromptInjectionDetection, - "environment", environment, - "excludedPredefinedFunctions", excludedPredefinedFunctions, - "type", type); + return Utils.toString( + ComputerUse.class, + "disabledSafetyPolicies", + disabledSafetyPolicies, + "enablePromptInjectionDetection", + enablePromptInjectionDetection, + "environment", + environment, + "excludedPredefinedFunctions", + excludedPredefinedFunctions, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List disabledSafetyPolicies; @@ -212,7 +209,7 @@ public final static class Builder { private List excludedPredefinedFunctions; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -250,15 +247,10 @@ public Builder excludedPredefinedFunctions(@Nullable List excludedPredef public ComputerUse build() { return new ComputerUse( - disabledSafetyPolicies, enablePromptInjectionDetection, environment, - excludedPredefinedFunctions); + disabledSafetyPolicies, enablePromptInjectionDetection, environment, excludedPredefinedFunctions); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"computer_use\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"computer_use\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Content.java b/src/main/java/com/google/genai/gaos/models/interactions/Content.java index 4c2dae838fc..80a7fd00e78 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Content.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Content.java @@ -19,15 +19,15 @@ */ package com.google.genai.gaos.models.interactions; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; -import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver; import java.lang.String; /** * Content - * + * *

The content of the response. */ @JsonTypeInfo( @@ -35,12 +35,9 @@ property = "type", include = As.EXISTING_PROPERTY, visible = true, - defaultImpl = UnknownContent.class -) + defaultImpl = UnknownContent.class) @JsonTypeIdResolver(ContentTypeIdResolver.class) public interface Content { String type(); - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ContentTypeIdResolver.java b/src/main/java/com/google/genai/gaos/models/interactions/ContentTypeIdResolver.java index f4fdef1dc73..15de7b67239 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ContentTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ContentTypeIdResolver.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.google.genai.gaos.utils.GenericTypeIdResolver; @@ -26,10 +25,9 @@ import java.lang.Override; import java.lang.String; - /** * ContentTypeIdResolver - * + * *

The content of the response. */ public class ContentTypeIdResolver extends GenericTypeIdResolver { @@ -52,19 +50,19 @@ public String idFromValue(Object value) { if (value == null) { return null; } - + // Handle known types by checking if they implement the discriminator method if (value instanceof Content) { Content discriminated = (Content) value; return discriminated.type(); } - - throw new IllegalArgumentException("Unknown value type: " + value.getClass().getName()); + + throw new IllegalArgumentException( + "Unknown value type: " + value.getClass().getName()); } @Override public String getDescForKnownTypeIds() { return "Content type resolver"; } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteraction.java b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteraction.java index 254ac45bb0a..e740eb277b2 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteraction.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteraction.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nonnull; @@ -36,7 +36,7 @@ /** * CreateAgentInteraction - * + * *

Parameters for creating agent interactions */ public class CreateAgentInteraction { @@ -83,7 +83,7 @@ public class CreateAgentInteraction { /** * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -93,7 +93,7 @@ public class CreateAgentInteraction { /** * The mime type of the response. This is required if response_format is set. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -108,7 +108,6 @@ public class CreateAgentInteraction { @JsonProperty("previous_interaction_id") private String previousInteractionId; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("service_tier") private ServiceTier serviceTier; @@ -182,8 +181,7 @@ public CreateAgentInteraction( @JsonProperty("safety_settings") @Nullable List safetySettings, @JsonProperty("labels") @Nullable Map labels, @JsonProperty("input") @Nonnull InteractionsInput input) { - this.agent = Optional.ofNullable(agent) - .orElseThrow(() -> new IllegalArgumentException("agent cannot be null")); + this.agent = Optional.ofNullable(agent).orElseThrow(() -> new IllegalArgumentException("agent cannot be null")); this.stream = stream; this.store = store; this.background = background; @@ -199,19 +197,11 @@ public CreateAgentInteraction( this.agentConfig = agentConfig; this.safetySettings = safetySettings; this.labels = labels; - this.input = Optional.ofNullable(input) - .orElseThrow(() -> new IllegalArgumentException("input cannot be null")); + this.input = Optional.ofNullable(input).orElseThrow(() -> new IllegalArgumentException("input cannot be null")); } - - public CreateAgentInteraction( - @Nonnull AgentOption agent, - @Nonnull InteractionsInput input) { - this(agent, null, null, - null, null, null, - null, null, null, - null, null, null, - null, null, null, - null, input); + + public CreateAgentInteraction(@Nonnull AgentOption agent, @Nonnull InteractionsInput input) { + this(agent, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, input); } /** @@ -258,7 +248,7 @@ public Optional> tools() { /** * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -268,7 +258,7 @@ public Optional> responseModalities() { /** * The mime type of the response. This is required if response_format is set. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -342,7 +332,6 @@ public static Builder builder() { return new Builder(); } - /** * The agent to interact with. */ @@ -351,7 +340,6 @@ public CreateAgentInteraction withAgent(@Nonnull AgentOption agent) { return this; } - /** * Input only. Whether the interaction will be streamed. */ @@ -360,7 +348,6 @@ public CreateAgentInteraction withStream(@Nullable Boolean stream) { return this; } - /** * Input only. Whether to store the response and request for later retrieval. */ @@ -369,7 +356,6 @@ public CreateAgentInteraction withStore(@Nullable Boolean store) { return this; } - /** * Input only. Whether to run the model interaction in the background. */ @@ -378,7 +364,6 @@ public CreateAgentInteraction withBackground(@Nullable Boolean background) { return this; } - /** * System instruction for the interaction. */ @@ -387,7 +372,6 @@ public CreateAgentInteraction withSystemInstruction(@Nullable String systemInstr return this; } - /** * A list of tool declarations the model may call during interaction. */ @@ -396,10 +380,9 @@ public CreateAgentInteraction withTools(@Nullable List tools) { return this; } - /** * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -408,10 +391,9 @@ public CreateAgentInteraction withResponseModalities(@Nullable List s return this; } - /** * The labels with user-defined metadata for the request. */ @@ -491,7 +465,6 @@ public CreateAgentInteraction withLabels(@Nullable Map labels) { return this; } - /** * The input for the interaction. */ @@ -500,7 +473,6 @@ public CreateAgentInteraction withInput(@Nonnull InteractionsInput input) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -510,61 +482,89 @@ public boolean equals(java.lang.Object o) { return false; } CreateAgentInteraction other = (CreateAgentInteraction) o; - return - Utils.enhancedDeepEquals(this.agent, other.agent) && - Utils.enhancedDeepEquals(this.stream, other.stream) && - Utils.enhancedDeepEquals(this.store, other.store) && - Utils.enhancedDeepEquals(this.background, other.background) && - Utils.enhancedDeepEquals(this.systemInstruction, other.systemInstruction) && - Utils.enhancedDeepEquals(this.tools, other.tools) && - Utils.enhancedDeepEquals(this.responseModalities, other.responseModalities) && - Utils.enhancedDeepEquals(this.responseMimeType, other.responseMimeType) && - Utils.enhancedDeepEquals(this.previousInteractionId, other.previousInteractionId) && - Utils.enhancedDeepEquals(this.serviceTier, other.serviceTier) && - Utils.enhancedDeepEquals(this.webhookConfig, other.webhookConfig) && - Utils.enhancedDeepEquals(this.responseFormat, other.responseFormat) && - Utils.enhancedDeepEquals(this.environment, other.environment) && - Utils.enhancedDeepEquals(this.agentConfig, other.agentConfig) && - Utils.enhancedDeepEquals(this.safetySettings, other.safetySettings) && - Utils.enhancedDeepEquals(this.labels, other.labels) && - Utils.enhancedDeepEquals(this.input, other.input); - } - + return Utils.enhancedDeepEquals(this.agent, other.agent) + && Utils.enhancedDeepEquals(this.stream, other.stream) + && Utils.enhancedDeepEquals(this.store, other.store) + && Utils.enhancedDeepEquals(this.background, other.background) + && Utils.enhancedDeepEquals(this.systemInstruction, other.systemInstruction) + && Utils.enhancedDeepEquals(this.tools, other.tools) + && Utils.enhancedDeepEquals(this.responseModalities, other.responseModalities) + && Utils.enhancedDeepEquals(this.responseMimeType, other.responseMimeType) + && Utils.enhancedDeepEquals(this.previousInteractionId, other.previousInteractionId) + && Utils.enhancedDeepEquals(this.serviceTier, other.serviceTier) + && Utils.enhancedDeepEquals(this.webhookConfig, other.webhookConfig) + && Utils.enhancedDeepEquals(this.responseFormat, other.responseFormat) + && Utils.enhancedDeepEquals(this.environment, other.environment) + && Utils.enhancedDeepEquals(this.agentConfig, other.agentConfig) + && Utils.enhancedDeepEquals(this.safetySettings, other.safetySettings) + && Utils.enhancedDeepEquals(this.labels, other.labels) + && Utils.enhancedDeepEquals(this.input, other.input); + } + @Override public int hashCode() { return Utils.enhancedHash( - agent, stream, store, - background, systemInstruction, tools, - responseModalities, responseMimeType, previousInteractionId, - serviceTier, webhookConfig, responseFormat, - environment, agentConfig, safetySettings, - labels, input); - } - + agent, + stream, + store, + background, + systemInstruction, + tools, + responseModalities, + responseMimeType, + previousInteractionId, + serviceTier, + webhookConfig, + responseFormat, + environment, + agentConfig, + safetySettings, + labels, + input); + } + @Override public String toString() { - return Utils.toString(CreateAgentInteraction.class, - "agent", agent, - "stream", stream, - "store", store, - "background", background, - "systemInstruction", systemInstruction, - "tools", tools, - "responseModalities", responseModalities, - "responseMimeType", responseMimeType, - "previousInteractionId", previousInteractionId, - "serviceTier", serviceTier, - "webhookConfig", webhookConfig, - "responseFormat", responseFormat, - "environment", environment, - "agentConfig", agentConfig, - "safetySettings", safetySettings, - "labels", labels, - "input", input); + return Utils.toString( + CreateAgentInteraction.class, + "agent", + agent, + "stream", + stream, + "store", + store, + "background", + background, + "systemInstruction", + systemInstruction, + "tools", + tools, + "responseModalities", + responseModalities, + "responseMimeType", + responseMimeType, + "previousInteractionId", + previousInteractionId, + "serviceTier", + serviceTier, + "webhookConfig", + webhookConfig, + "responseFormat", + responseFormat, + "environment", + environment, + "agentConfig", + agentConfig, + "safetySettings", + safetySettings, + "labels", + labels, + "input", + input); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private AgentOption agent; @@ -603,7 +603,7 @@ public final static class Builder { private InteractionsInput input; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -661,7 +661,7 @@ public Builder tools(@Nullable List tools) { /** * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -672,7 +672,7 @@ public Builder responseModalities(@Nullable List responseModal /** * The mime type of the response. This is required if response_format is set. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -754,13 +754,23 @@ public Builder input(@Nonnull InteractionsInput input) { public CreateAgentInteraction build() { return new CreateAgentInteraction( - agent, stream, store, - background, systemInstruction, tools, - responseModalities, responseMimeType, previousInteractionId, - serviceTier, webhookConfig, responseFormat, - environment, agentConfig, safetySettings, - labels, input); + agent, + stream, + store, + background, + systemInstruction, + tools, + responseModalities, + responseMimeType, + previousInteractionId, + serviceTier, + webhookConfig, + responseFormat, + environment, + agentConfig, + safetySettings, + labels, + input); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionAgentConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionAgentConfig.java index f63e41039c4..8fe81d95389 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionAgentConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionAgentConfig.java @@ -19,15 +19,15 @@ */ package com.google.genai.gaos.models.interactions; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; -import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver; import java.lang.String; /** * CreateAgentInteractionAgentConfig - * + * *

Configuration parameters for the agent interaction. */ @JsonTypeInfo( @@ -35,12 +35,9 @@ property = "type", include = As.EXISTING_PROPERTY, visible = true, - defaultImpl = UnknownCreateAgentInteractionAgentConfig.class -) + defaultImpl = UnknownCreateAgentInteractionAgentConfig.class) @JsonTypeIdResolver(CreateAgentInteractionAgentConfigTypeIdResolver.class) public interface CreateAgentInteractionAgentConfig { String type(); - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionAgentConfigTypeIdResolver.java b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionAgentConfigTypeIdResolver.java index c03634e78fa..c15e6939622 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionAgentConfigTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionAgentConfigTypeIdResolver.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.google.genai.gaos.utils.GenericTypeIdResolver; @@ -26,13 +25,13 @@ import java.lang.Override; import java.lang.String; - /** * CreateAgentInteractionAgentConfigTypeIdResolver - * + * *

Configuration parameters for the agent interaction. */ -public class CreateAgentInteractionAgentConfigTypeIdResolver extends GenericTypeIdResolver { +public class CreateAgentInteractionAgentConfigTypeIdResolver + extends GenericTypeIdResolver { public CreateAgentInteractionAgentConfigTypeIdResolver() { super(UnknownCreateAgentInteractionAgentConfig.class); @@ -51,19 +50,19 @@ public String idFromValue(Object value) { if (value == null) { return null; } - + // Handle known types by checking if they implement the discriminator method if (value instanceof CreateAgentInteractionAgentConfig) { CreateAgentInteractionAgentConfig discriminated = (CreateAgentInteractionAgentConfig) value; return discriminated.type(); } - - throw new IllegalArgumentException("Unknown value type: " + value.getClass().getName()); + + throw new IllegalArgumentException( + "Unknown value type: " + value.getClass().getName()); } @Override public String getDescForKnownTypeIds() { return "CreateAgentInteractionAgentConfig type resolver"; } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionEnvironment.java b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionEnvironment.java index 914a614bf76..d0fede7b36e 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionEnvironment.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionEnvironment.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -35,7 +35,7 @@ /** * CreateAgentInteractionEnvironment - * + * *

The environment configuration for the interaction. Can be an object specifying remote environment * sources or a string referencing an existing environment ID. */ @@ -44,21 +44,23 @@ public class CreateAgentInteractionEnvironment { @JsonValue private final TypedObject value; - + private CreateAgentInteractionEnvironment(TypedObject value) { this.value = value; } public static CreateAgentInteractionEnvironment of(String value) { Utils.checkNotNull(value, "value"); - return new CreateAgentInteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateAgentInteractionEnvironment( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static CreateAgentInteractionEnvironment of(Environment value) { Utils.checkNotNull(value, "value"); - return new CreateAgentInteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateAgentInteractionEnvironment( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code String}, * otherwise returns an empty {@link Optional}. @@ -71,7 +73,7 @@ public Optional string() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code Environment}, * otherwise returns an empty {@link Optional}. @@ -84,19 +86,19 @@ public Optional environment() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -108,27 +110,26 @@ public boolean equals(java.lang.Object o) { CreateAgentInteractionEnvironment other = (CreateAgentInteractionEnvironment) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(CreateAgentInteractionEnvironment.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + CreateAgentInteractionEnvironment.class, + false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(CreateAgentInteractionEnvironment.class, - "value", value); + return Utils.toString(CreateAgentInteractionEnvironment.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionResponseFormat.java b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionResponseFormat.java index cc1c46b0263..6f917d3a441 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionResponseFormat.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionResponseFormat.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -36,7 +36,7 @@ /** * CreateAgentInteractionResponseFormat - * + * *

Enforces that the generated response is a JSON object that complies with the JSON schema specified * in this field. */ @@ -45,21 +45,23 @@ public class CreateAgentInteractionResponseFormat { @JsonValue private final TypedObject value; - + private CreateAgentInteractionResponseFormat(TypedObject value) { this.value = value; } public static CreateAgentInteractionResponseFormat of(List value) { Utils.checkNotNull(value, "value"); - return new CreateAgentInteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new CreateAgentInteractionResponseFormat( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>() {})); } public static CreateAgentInteractionResponseFormat of(ResponseFormat value) { Utils.checkNotNull(value, "value"); - return new CreateAgentInteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateAgentInteractionResponseFormat( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code List}, * otherwise returns an empty {@link Optional}. @@ -73,7 +75,7 @@ public Optional> arrayOfResponseFormat() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code ResponseFormat}, * otherwise returns an empty {@link Optional}. @@ -86,19 +88,19 @@ public Optional responseFormat() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -110,27 +112,26 @@ public boolean equals(java.lang.Object o) { CreateAgentInteractionResponseFormat other = (CreateAgentInteractionResponseFormat) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(CreateAgentInteractionResponseFormat.class, false, - TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + CreateAgentInteractionResponseFormat.class, + false, + TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(CreateAgentInteractionResponseFormat.class, - "value", value); + return Utils.toString(CreateAgentInteractionResponseFormat.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteraction.java b/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteraction.java index b9b93501d68..e103e00c5dc 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteraction.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteraction.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nonnull; @@ -36,7 +36,7 @@ /** * CreateModelInteraction - * + * *

Parameters for creating model interactions */ public class CreateModelInteraction { @@ -84,7 +84,7 @@ public class CreateModelInteraction { /** * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -94,7 +94,7 @@ public class CreateModelInteraction { /** * The mime type of the response. This is required if response_format is set. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -109,7 +109,6 @@ public class CreateModelInteraction { @JsonProperty("previous_interaction_id") private String previousInteractionId; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("service_tier") private ServiceTier serviceTier; @@ -183,8 +182,7 @@ public CreateModelInteraction( @JsonProperty("safety_settings") @Nullable List safetySettings, @JsonProperty("labels") @Nullable Map labels, @JsonProperty("input") @Nonnull InteractionsInput input) { - this.model = Optional.ofNullable(model) - .orElseThrow(() -> new IllegalArgumentException("model cannot be null")); + this.model = Optional.ofNullable(model).orElseThrow(() -> new IllegalArgumentException("model cannot be null")); this.stream = stream; this.store = store; this.background = background; @@ -200,19 +198,11 @@ public CreateModelInteraction( this.generationConfig = generationConfig; this.safetySettings = safetySettings; this.labels = labels; - this.input = Optional.ofNullable(input) - .orElseThrow(() -> new IllegalArgumentException("input cannot be null")); + this.input = Optional.ofNullable(input).orElseThrow(() -> new IllegalArgumentException("input cannot be null")); } - - public CreateModelInteraction( - @Nonnull Model model, - @Nonnull InteractionsInput input) { - this(model, null, null, - null, null, null, - null, null, null, - null, null, null, - null, null, null, - null, input); + + public CreateModelInteraction(@Nonnull Model model, @Nonnull InteractionsInput input) { + this(model, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, input); } /** @@ -260,7 +250,7 @@ public Optional> tools() { /** * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -270,7 +260,7 @@ public Optional> responseModalities() { /** * The mime type of the response. This is required if response_format is set. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -344,7 +334,6 @@ public static Builder builder() { return new Builder(); } - /** * The model that will complete your prompt.\n\nSee * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. @@ -354,7 +343,6 @@ public CreateModelInteraction withModel(@Nonnull Model model) { return this; } - /** * Input only. Whether the interaction will be streamed. */ @@ -363,7 +351,6 @@ public CreateModelInteraction withStream(@Nullable Boolean stream) { return this; } - /** * Input only. Whether to store the response and request for later retrieval. */ @@ -372,7 +359,6 @@ public CreateModelInteraction withStore(@Nullable Boolean store) { return this; } - /** * Input only. Whether to run the model interaction in the background. */ @@ -381,7 +367,6 @@ public CreateModelInteraction withBackground(@Nullable Boolean background) { return this; } - /** * System instruction for the interaction. */ @@ -390,7 +375,6 @@ public CreateModelInteraction withSystemInstruction(@Nullable String systemInstr return this; } - /** * A list of tool declarations the model may call during interaction. */ @@ -399,10 +383,9 @@ public CreateModelInteraction withTools(@Nullable List tools) { return this; } - /** * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -411,10 +394,9 @@ public CreateModelInteraction withResponseModalities(@Nullable List s return this; } - /** * The labels with user-defined metadata for the request. */ @@ -494,7 +468,6 @@ public CreateModelInteraction withLabels(@Nullable Map labels) { return this; } - /** * The input for the interaction. */ @@ -503,7 +476,6 @@ public CreateModelInteraction withInput(@Nonnull InteractionsInput input) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -513,61 +485,89 @@ public boolean equals(java.lang.Object o) { return false; } CreateModelInteraction other = (CreateModelInteraction) o; - return - Utils.enhancedDeepEquals(this.model, other.model) && - Utils.enhancedDeepEquals(this.stream, other.stream) && - Utils.enhancedDeepEquals(this.store, other.store) && - Utils.enhancedDeepEquals(this.background, other.background) && - Utils.enhancedDeepEquals(this.systemInstruction, other.systemInstruction) && - Utils.enhancedDeepEquals(this.tools, other.tools) && - Utils.enhancedDeepEquals(this.responseModalities, other.responseModalities) && - Utils.enhancedDeepEquals(this.responseMimeType, other.responseMimeType) && - Utils.enhancedDeepEquals(this.previousInteractionId, other.previousInteractionId) && - Utils.enhancedDeepEquals(this.serviceTier, other.serviceTier) && - Utils.enhancedDeepEquals(this.webhookConfig, other.webhookConfig) && - Utils.enhancedDeepEquals(this.responseFormat, other.responseFormat) && - Utils.enhancedDeepEquals(this.environment, other.environment) && - Utils.enhancedDeepEquals(this.generationConfig, other.generationConfig) && - Utils.enhancedDeepEquals(this.safetySettings, other.safetySettings) && - Utils.enhancedDeepEquals(this.labels, other.labels) && - Utils.enhancedDeepEquals(this.input, other.input); - } - + return Utils.enhancedDeepEquals(this.model, other.model) + && Utils.enhancedDeepEquals(this.stream, other.stream) + && Utils.enhancedDeepEquals(this.store, other.store) + && Utils.enhancedDeepEquals(this.background, other.background) + && Utils.enhancedDeepEquals(this.systemInstruction, other.systemInstruction) + && Utils.enhancedDeepEquals(this.tools, other.tools) + && Utils.enhancedDeepEquals(this.responseModalities, other.responseModalities) + && Utils.enhancedDeepEquals(this.responseMimeType, other.responseMimeType) + && Utils.enhancedDeepEquals(this.previousInteractionId, other.previousInteractionId) + && Utils.enhancedDeepEquals(this.serviceTier, other.serviceTier) + && Utils.enhancedDeepEquals(this.webhookConfig, other.webhookConfig) + && Utils.enhancedDeepEquals(this.responseFormat, other.responseFormat) + && Utils.enhancedDeepEquals(this.environment, other.environment) + && Utils.enhancedDeepEquals(this.generationConfig, other.generationConfig) + && Utils.enhancedDeepEquals(this.safetySettings, other.safetySettings) + && Utils.enhancedDeepEquals(this.labels, other.labels) + && Utils.enhancedDeepEquals(this.input, other.input); + } + @Override public int hashCode() { return Utils.enhancedHash( - model, stream, store, - background, systemInstruction, tools, - responseModalities, responseMimeType, previousInteractionId, - serviceTier, webhookConfig, responseFormat, - environment, generationConfig, safetySettings, - labels, input); - } - + model, + stream, + store, + background, + systemInstruction, + tools, + responseModalities, + responseMimeType, + previousInteractionId, + serviceTier, + webhookConfig, + responseFormat, + environment, + generationConfig, + safetySettings, + labels, + input); + } + @Override public String toString() { - return Utils.toString(CreateModelInteraction.class, - "model", model, - "stream", stream, - "store", store, - "background", background, - "systemInstruction", systemInstruction, - "tools", tools, - "responseModalities", responseModalities, - "responseMimeType", responseMimeType, - "previousInteractionId", previousInteractionId, - "serviceTier", serviceTier, - "webhookConfig", webhookConfig, - "responseFormat", responseFormat, - "environment", environment, - "generationConfig", generationConfig, - "safetySettings", safetySettings, - "labels", labels, - "input", input); + return Utils.toString( + CreateModelInteraction.class, + "model", + model, + "stream", + stream, + "store", + store, + "background", + background, + "systemInstruction", + systemInstruction, + "tools", + tools, + "responseModalities", + responseModalities, + "responseMimeType", + responseMimeType, + "previousInteractionId", + previousInteractionId, + "serviceTier", + serviceTier, + "webhookConfig", + webhookConfig, + "responseFormat", + responseFormat, + "environment", + environment, + "generationConfig", + generationConfig, + "safetySettings", + safetySettings, + "labels", + labels, + "input", + input); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Model model; @@ -606,7 +606,7 @@ public final static class Builder { private InteractionsInput input; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -665,7 +665,7 @@ public Builder tools(@Nullable List tools) { /** * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -676,7 +676,7 @@ public Builder responseModalities(@Nullable List responseModal /** * The mime type of the response. This is required if response_format is set. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -758,13 +758,23 @@ public Builder input(@Nonnull InteractionsInput input) { public CreateModelInteraction build() { return new CreateModelInteraction( - model, stream, store, - background, systemInstruction, tools, - responseModalities, responseMimeType, previousInteractionId, - serviceTier, webhookConfig, responseFormat, - environment, generationConfig, safetySettings, - labels, input); + model, + stream, + store, + background, + systemInstruction, + tools, + responseModalities, + responseMimeType, + previousInteractionId, + serviceTier, + webhookConfig, + responseFormat, + environment, + generationConfig, + safetySettings, + labels, + input); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteractionEnvironment.java b/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteractionEnvironment.java index f6f8a8b8efb..9eb29dd992d 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteractionEnvironment.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteractionEnvironment.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -35,7 +35,7 @@ /** * CreateModelInteractionEnvironment - * + * *

The environment configuration for the interaction. Can be an object specifying remote environment * sources or a string referencing an existing environment ID. */ @@ -44,21 +44,23 @@ public class CreateModelInteractionEnvironment { @JsonValue private final TypedObject value; - + private CreateModelInteractionEnvironment(TypedObject value) { this.value = value; } public static CreateModelInteractionEnvironment of(String value) { Utils.checkNotNull(value, "value"); - return new CreateModelInteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateModelInteractionEnvironment( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static CreateModelInteractionEnvironment of(Environment value) { Utils.checkNotNull(value, "value"); - return new CreateModelInteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateModelInteractionEnvironment( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code String}, * otherwise returns an empty {@link Optional}. @@ -71,7 +73,7 @@ public Optional string() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code Environment}, * otherwise returns an empty {@link Optional}. @@ -84,19 +86,19 @@ public Optional environment() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -108,27 +110,26 @@ public boolean equals(java.lang.Object o) { CreateModelInteractionEnvironment other = (CreateModelInteractionEnvironment) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(CreateModelInteractionEnvironment.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + CreateModelInteractionEnvironment.class, + false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(CreateModelInteractionEnvironment.class, - "value", value); + return Utils.toString(CreateModelInteractionEnvironment.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteractionResponseFormat.java b/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteractionResponseFormat.java index 441cbfd26c0..5561c63ee4f 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteractionResponseFormat.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteractionResponseFormat.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -36,7 +36,7 @@ /** * CreateModelInteractionResponseFormat - * + * *

Enforces that the generated response is a JSON object that complies with the JSON schema specified * in this field. */ @@ -45,21 +45,23 @@ public class CreateModelInteractionResponseFormat { @JsonValue private final TypedObject value; - + private CreateModelInteractionResponseFormat(TypedObject value) { this.value = value; } public static CreateModelInteractionResponseFormat of(List value) { Utils.checkNotNull(value, "value"); - return new CreateModelInteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new CreateModelInteractionResponseFormat( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>() {})); } public static CreateModelInteractionResponseFormat of(ResponseFormat value) { Utils.checkNotNull(value, "value"); - return new CreateModelInteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateModelInteractionResponseFormat( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code List}, * otherwise returns an empty {@link Optional}. @@ -73,7 +75,7 @@ public Optional> arrayOfResponseFormat() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code ResponseFormat}, * otherwise returns an empty {@link Optional}. @@ -86,19 +88,19 @@ public Optional responseFormat() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -110,27 +112,26 @@ public boolean equals(java.lang.Object o) { CreateModelInteractionResponseFormat other = (CreateModelInteractionResponseFormat) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(CreateModelInteractionResponseFormat.class, false, - TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + CreateModelInteractionResponseFormat.class, + false, + TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(CreateModelInteractionResponseFormat.class, - "value", value); + return Utils.toString(CreateModelInteractionResponseFormat.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/DeepResearchAgentConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/DeepResearchAgentConfig.java index 1f936b0d690..c69c3e104b5 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/DeepResearchAgentConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/DeepResearchAgentConfig.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * DeepResearchAgentConfig - * + * *

Configuration for the Deep Research agent. */ public class DeepResearchAgentConfig implements InteractionAgentConfig, CreateAgentInteractionAgentConfig { @@ -55,12 +55,10 @@ public class DeepResearchAgentConfig implements InteractionAgentConfig, CreateAg @JsonProperty("enable_bigquery_tool") private Boolean enableBigqueryTool; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("thinking_summaries") private ThinkingSummaries thinkingSummaries; - @JsonProperty("type") private String type; @@ -83,10 +81,9 @@ public DeepResearchAgentConfig( this.type = Builder._SINGLETON_VALUE_Type.value(); this.visualization = visualization; } - + public DeepResearchAgentConfig() { - this(null, null, null, - null); + this(null, null, null, null); } /** @@ -126,7 +123,6 @@ public static Builder builder() { return new Builder(); } - /** * Enables human-in-the-loop planning for the Deep Research agent. If set to * true, the Deep Research agent will provide a research plan in its response. @@ -138,7 +134,6 @@ public DeepResearchAgentConfig withCollaborativePlanning(@Nullable Boolean colla return this; } - /** * Enables bigquery tool for the Deep Research agent. */ @@ -147,13 +142,11 @@ public DeepResearchAgentConfig withEnableBigqueryTool(@Nullable Boolean enableBi return this; } - public DeepResearchAgentConfig withThinkingSummaries(@Nullable ThinkingSummaries thinkingSummaries) { this.thinkingSummaries = thinkingSummaries; return this; } - /** * Whether to include visualizations in the response. */ @@ -162,7 +155,6 @@ public DeepResearchAgentConfig withVisualization(@Nullable Visualization visuali return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -172,33 +164,36 @@ public boolean equals(java.lang.Object o) { return false; } DeepResearchAgentConfig other = (DeepResearchAgentConfig) o; - return - Utils.enhancedDeepEquals(this.collaborativePlanning, other.collaborativePlanning) && - Utils.enhancedDeepEquals(this.enableBigqueryTool, other.enableBigqueryTool) && - Utils.enhancedDeepEquals(this.thinkingSummaries, other.thinkingSummaries) && - Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.visualization, other.visualization); + return Utils.enhancedDeepEquals(this.collaborativePlanning, other.collaborativePlanning) + && Utils.enhancedDeepEquals(this.enableBigqueryTool, other.enableBigqueryTool) + && Utils.enhancedDeepEquals(this.thinkingSummaries, other.thinkingSummaries) + && Utils.enhancedDeepEquals(this.type, other.type) + && Utils.enhancedDeepEquals(this.visualization, other.visualization); } - + @Override public int hashCode() { - return Utils.enhancedHash( - collaborativePlanning, enableBigqueryTool, thinkingSummaries, - type, visualization); + return Utils.enhancedHash(collaborativePlanning, enableBigqueryTool, thinkingSummaries, type, visualization); } - + @Override public String toString() { - return Utils.toString(DeepResearchAgentConfig.class, - "collaborativePlanning", collaborativePlanning, - "enableBigqueryTool", enableBigqueryTool, - "thinkingSummaries", thinkingSummaries, - "type", type, - "visualization", visualization); + return Utils.toString( + DeepResearchAgentConfig.class, + "collaborativePlanning", + collaborativePlanning, + "enableBigqueryTool", + enableBigqueryTool, + "thinkingSummaries", + thinkingSummaries, + "type", + type, + "visualization", + visualization); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Boolean collaborativePlanning; @@ -209,7 +204,7 @@ public final static class Builder { private Visualization visualization; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -246,15 +241,10 @@ public Builder visualization(@Nullable Visualization visualization) { public DeepResearchAgentConfig build() { return new DeepResearchAgentConfig( - collaborativePlanning, enableBigqueryTool, thinkingSummaries, - visualization); + collaborativePlanning, enableBigqueryTool, thinkingSummaries, visualization); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"deep-research\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"deep-research\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Disabled.java b/src/main/java/com/google/genai/gaos/models/interactions/Disabled.java index a4b38ef7264..991c1f96ed5 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Disabled.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Disabled.java @@ -36,7 +36,7 @@ */ /** * Disabled - * + * *

Turns all network off. */ public class Disabled { @@ -58,12 +58,12 @@ private Disabled(String value) { } /** - * Returns a Disabled with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a Disabled with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as Disabled - */ + */ @JsonCreator public static Disabled of(String value) { synchronized (Disabled.class) { @@ -91,12 +91,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; Disabled other = (Disabled) obj; return Objects.equals(value, other.value); } @@ -124,11 +121,11 @@ private static final Map createEnumsMap() { map.put("disabled", DisabledEnum.DISABLED); return map; } - - + public enum DisabledEnum { - DISABLED("disabled"),; + DISABLED("disabled"), + ; private final String value; @@ -141,4 +138,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/DisabledSafetyPolicy.java b/src/main/java/com/google/genai/gaos/models/interactions/DisabledSafetyPolicy.java index 6ec48cc8022..6b9241a1518 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/DisabledSafetyPolicy.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/DisabledSafetyPolicy.java @@ -36,13 +36,17 @@ */ public class DisabledSafetyPolicy { - public static final DisabledSafetyPolicy FINANCIAL_TRANSACTIONS = new DisabledSafetyPolicy("financial_transactions"); - public static final DisabledSafetyPolicy SENSITIVE_DATA_MODIFICATION = new DisabledSafetyPolicy("sensitive_data_modification"); + public static final DisabledSafetyPolicy FINANCIAL_TRANSACTIONS = + new DisabledSafetyPolicy("financial_transactions"); + public static final DisabledSafetyPolicy SENSITIVE_DATA_MODIFICATION = + new DisabledSafetyPolicy("sensitive_data_modification"); public static final DisabledSafetyPolicy COMMUNICATION_TOOL = new DisabledSafetyPolicy("communication_tool"); public static final DisabledSafetyPolicy ACCOUNT_CREATION = new DisabledSafetyPolicy("account_creation"); public static final DisabledSafetyPolicy DATA_MODIFICATION = new DisabledSafetyPolicy("data_modification"); - public static final DisabledSafetyPolicy USER_CONSENT_MANAGEMENT = new DisabledSafetyPolicy("user_consent_management"); - public static final DisabledSafetyPolicy LEGAL_TERMS_AND_AGREEMENTS = new DisabledSafetyPolicy("legal_terms_and_agreements"); + public static final DisabledSafetyPolicy USER_CONSENT_MANAGEMENT = + new DisabledSafetyPolicy("user_consent_management"); + public static final DisabledSafetyPolicy LEGAL_TERMS_AND_AGREEMENTS = + new DisabledSafetyPolicy("legal_terms_and_agreements"); // This map will grow whenever a Color gets created with a new // unrecognized value (a potential memory leak if the user is not @@ -59,12 +63,12 @@ private DisabledSafetyPolicy(String value) { } /** - * Returns a DisabledSafetyPolicy with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a DisabledSafetyPolicy with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as DisabledSafetyPolicy - */ + */ @JsonCreator public static DisabledSafetyPolicy of(String value) { synchronized (DisabledSafetyPolicy.class) { @@ -92,12 +96,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; DisabledSafetyPolicy other = (DisabledSafetyPolicy) obj; return Objects.equals(value, other.value); } @@ -137,8 +138,7 @@ private static final Map createEnumsMap() { map.put("legal_terms_and_agreements", DisabledSafetyPolicyEnum.LEGAL_TERMS_AND_AGREEMENTS); return map; } - - + public enum DisabledSafetyPolicyEnum { FINANCIAL_TRANSACTIONS("financial_transactions"), @@ -147,7 +147,8 @@ public enum DisabledSafetyPolicyEnum { ACCOUNT_CREATION("account_creation"), DATA_MODIFICATION("data_modification"), USER_CONSENT_MANAGEMENT("user_consent_management"), - LEGAL_TERMS_AND_AGREEMENTS("legal_terms_and_agreements"),; + LEGAL_TERMS_AND_AGREEMENTS("legal_terms_and_agreements"), + ; private final String value; @@ -160,4 +161,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/DocumentContent.java b/src/main/java/com/google/genai/gaos/models/interactions/DocumentContent.java index fc703bc0135..50d9795a78c 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/DocumentContent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/DocumentContent.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -33,7 +33,7 @@ /** * DocumentContent - * + * *

A document content block. */ public class DocumentContent implements Content { @@ -44,7 +44,6 @@ public class DocumentContent implements Content { @JsonProperty("data") private String data; - @JsonProperty("type") private String type; @@ -72,7 +71,7 @@ public DocumentContent( this.uri = uri; this.mimeType = mimeType; } - + public DocumentContent() { this(null, null, null); } @@ -107,7 +106,6 @@ public static Builder builder() { return new Builder(); } - /** * The document content. */ @@ -116,7 +114,6 @@ public DocumentContent withData(@Nullable String data) { return this; } - /** * The URI of the document. */ @@ -125,7 +122,6 @@ public DocumentContent withUri(@Nullable String uri) { return this; } - /** * The mime type of the document. */ @@ -134,7 +130,6 @@ public DocumentContent withMimeType(@Nullable DocumentContentMimeType mimeType) return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -144,31 +139,24 @@ public boolean equals(java.lang.Object o) { return false; } DocumentContent other = (DocumentContent) o; - return - Utils.enhancedDeepEquals(this.data, other.data) && - Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.uri, other.uri) && - Utils.enhancedDeepEquals(this.mimeType, other.mimeType); + return Utils.enhancedDeepEquals(this.data, other.data) + && Utils.enhancedDeepEquals(this.type, other.type) + && Utils.enhancedDeepEquals(this.uri, other.uri) + && Utils.enhancedDeepEquals(this.mimeType, other.mimeType); } - + @Override public int hashCode() { - return Utils.enhancedHash( - data, type, uri, - mimeType); + return Utils.enhancedHash(data, type, uri, mimeType); } - + @Override public String toString() { - return Utils.toString(DocumentContent.class, - "data", data, - "type", type, - "uri", uri, - "mimeType", mimeType); + return Utils.toString(DocumentContent.class, "data", data, "type", type, "uri", uri, "mimeType", mimeType); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String data; @@ -177,7 +165,7 @@ public final static class Builder { private DocumentContentMimeType mimeType; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -205,15 +193,10 @@ public Builder mimeType(@Nullable DocumentContentMimeType mimeType) { } public DocumentContent build() { - return new DocumentContent( - data, uri, mimeType); + return new DocumentContent(data, uri, mimeType); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"document\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"document\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/DocumentContentMimeType.java b/src/main/java/com/google/genai/gaos/models/interactions/DocumentContentMimeType.java index d9b93c98e89..83338e76572 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/DocumentContentMimeType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/DocumentContentMimeType.java @@ -36,7 +36,7 @@ */ /** * DocumentContentMimeType - * + * *

The mime type of the document. */ public class DocumentContentMimeType { @@ -59,12 +59,12 @@ private DocumentContentMimeType(String value) { } /** - * Returns a DocumentContentMimeType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a DocumentContentMimeType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as DocumentContentMimeType - */ + */ @JsonCreator public static DocumentContentMimeType of(String value) { synchronized (DocumentContentMimeType.class) { @@ -92,12 +92,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; DocumentContentMimeType other = (DocumentContentMimeType) obj; return Objects.equals(value, other.value); } @@ -127,12 +124,12 @@ private static final Map createEnumsMap() { map.put("text/csv", DocumentContentMimeTypeEnum.TEXT_CSV); return map; } - - + public enum DocumentContentMimeTypeEnum { APPLICATION_PDF("application/pdf"), - TEXT_CSV("text/csv"),; + TEXT_CSV("text/csv"), + ; private final String value; @@ -145,4 +142,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/DocumentDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/DocumentDelta.java index fb1a1214d7b..7827a3181dc 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/DocumentDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/DocumentDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -31,23 +31,19 @@ import java.lang.String; import java.util.Optional; - public class DocumentDelta implements StepDeltaData { @JsonInclude(Include.NON_ABSENT) @JsonProperty("data") private String data; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("mime_type") private DocumentDeltaMimeType mimeType; - @JsonProperty("type") private String type; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("uri") private String uri; @@ -62,7 +58,7 @@ public DocumentDelta( this.type = Builder._SINGLETON_VALUE_Type.value(); this.uri = uri; } - + public DocumentDelta() { this(null, null, null); } @@ -88,25 +84,21 @@ public static Builder builder() { return new Builder(); } - public DocumentDelta withData(@Nullable String data) { this.data = data; return this; } - public DocumentDelta withMimeType(@Nullable DocumentDeltaMimeType mimeType) { this.mimeType = mimeType; return this; } - public DocumentDelta withUri(@Nullable String uri) { this.uri = uri; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -116,31 +108,24 @@ public boolean equals(java.lang.Object o) { return false; } DocumentDelta other = (DocumentDelta) o; - return - Utils.enhancedDeepEquals(this.data, other.data) && - Utils.enhancedDeepEquals(this.mimeType, other.mimeType) && - Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.uri, other.uri); + return Utils.enhancedDeepEquals(this.data, other.data) + && Utils.enhancedDeepEquals(this.mimeType, other.mimeType) + && Utils.enhancedDeepEquals(this.type, other.type) + && Utils.enhancedDeepEquals(this.uri, other.uri); } - + @Override public int hashCode() { - return Utils.enhancedHash( - data, mimeType, type, - uri); + return Utils.enhancedHash(data, mimeType, type, uri); } - + @Override public String toString() { - return Utils.toString(DocumentDelta.class, - "data", data, - "mimeType", mimeType, - "type", type, - "uri", uri); + return Utils.toString(DocumentDelta.class, "data", data, "mimeType", mimeType, "type", type, "uri", uri); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String data; @@ -149,7 +134,7 @@ public final static class Builder { private String uri; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder data(@Nullable String data) { @@ -168,15 +153,10 @@ public Builder uri(@Nullable String uri) { } public DocumentDelta build() { - return new DocumentDelta( - data, mimeType, uri); + return new DocumentDelta(data, mimeType, uri); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"document\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"document\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/DocumentDeltaMimeType.java b/src/main/java/com/google/genai/gaos/models/interactions/DocumentDeltaMimeType.java index 811ca5ae549..f1e25cad2ea 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/DocumentDeltaMimeType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/DocumentDeltaMimeType.java @@ -54,12 +54,12 @@ private DocumentDeltaMimeType(String value) { } /** - * Returns a DocumentDeltaMimeType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a DocumentDeltaMimeType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as DocumentDeltaMimeType - */ + */ @JsonCreator public static DocumentDeltaMimeType of(String value) { synchronized (DocumentDeltaMimeType.class) { @@ -87,12 +87,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; DocumentDeltaMimeType other = (DocumentDeltaMimeType) obj; return Objects.equals(value, other.value); } @@ -122,12 +119,12 @@ private static final Map createEnumsMap() { map.put("text/csv", DocumentDeltaMimeTypeEnum.TEXT_CSV); return map; } - - + public enum DocumentDeltaMimeTypeEnum { APPLICATION_PDF("application/pdf"), - TEXT_CSV("text/csv"),; + TEXT_CSV("text/csv"), + ; private final String value; @@ -140,4 +137,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/DynamicAgentConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/DynamicAgentConfig.java index 573428eaac5..1306389de61 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/DynamicAgentConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/DynamicAgentConfig.java @@ -36,7 +36,7 @@ /** * DynamicAgentConfig - * + * *

Configuration for dynamic agents. */ public class DynamicAgentConfig implements InteractionAgentConfig, CreateAgentInteractionAgentConfig { @@ -44,7 +44,6 @@ public class DynamicAgentConfig implements InteractionAgentConfig, CreateAgentIn @JsonProperty("type") private String type; - @JsonIgnore private Map additionalProperties; @@ -68,7 +67,6 @@ public static Builder builder() { return new Builder(); } - @JsonAnySetter public DynamicAgentConfig withAdditionalProperty(String key, Object value) { // note that value can be null because of the way JsonAnySetter works @@ -82,7 +80,6 @@ public DynamicAgentConfig withAdditionalProperties(@Nullable Map return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -92,31 +89,27 @@ public boolean equals(java.lang.Object o) { return false; } DynamicAgentConfig other = (DynamicAgentConfig) o; - return - Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.additionalProperties, other.additionalProperties); + return Utils.enhancedDeepEquals(this.type, other.type) + && Utils.enhancedDeepEquals(this.additionalProperties, other.additionalProperties); } - + @Override public int hashCode() { - return Utils.enhancedHash( - type, additionalProperties); + return Utils.enhancedHash(type, additionalProperties); } - + @Override public String toString() { - return Utils.toString(DynamicAgentConfig.class, - "type", type, - "additionalProperties", additionalProperties); + return Utils.toString(DynamicAgentConfig.class, "type", type, "additionalProperties", additionalProperties); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Map additionalProperties = new HashMap<>(); private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder additionalProperty(String key, Object value) { @@ -124,22 +117,17 @@ public Builder additionalProperty(String key, Object value) { this.additionalProperties.put(key, value); return this; } + public Builder additionalProperties(@Nullable Map additionalProperties) { this.additionalProperties = additionalProperties; return this; } public DynamicAgentConfig build() { - return new DynamicAgentConfig( - ) - .withAdditionalProperties(additionalProperties); + return new DynamicAgentConfig().withAdditionalProperties(additionalProperties); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"dynamic\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"dynamic\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Empty.java b/src/main/java/com/google/genai/gaos/models/interactions/Empty.java index 744540f670f..0a3037fbc3d 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Empty.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Empty.java @@ -26,25 +26,23 @@ /** * Empty - * + * *

A generic empty message that you can re-use to avoid defining duplicated * empty messages in your APIs. A typical example is to use it as the request * or the response type of an API method. For instance: - * + * *

service Foo { * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); * } */ public class Empty { @JsonCreator - public Empty() { - } + public Empty() {} public static Builder builder() { return new Builder(); } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -55,29 +53,26 @@ public boolean equals(java.lang.Object o) { } return true; } - + @Override public int hashCode() { - return Utils.enhancedHash( - ); + return Utils.enhancedHash(); } - + @Override public String toString() { return Utils.toString(Empty.class); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Builder() { - // force use of static builder() method + // force use of static builder() method } public Empty build() { - return new Empty( - ); + return new Empty(); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Environment.java b/src/main/java/com/google/genai/gaos/models/interactions/Environment.java index 802f8b263cd..0f4a1ad394a 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Environment.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Environment.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * Environment - * + * *

Configuration for a custom environment. */ public class Environment { @@ -53,12 +53,10 @@ public class Environment { @JsonProperty("network") private Network network; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("sources") private List sources; - @JsonProperty("type") private String type; @@ -72,7 +70,7 @@ public Environment( this.sources = sources; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public Environment() { this(null, null, null); } @@ -104,7 +102,6 @@ public static Builder builder() { return new Builder(); } - /** * Optional. The environment ID for the interaction. If specified, the request will * update the existing environment instead of creating a new one. @@ -114,7 +111,6 @@ public Environment withEnvironmentId(@Nullable String environmentId) { return this; } - /** * Network configuration for the environment. */ @@ -123,13 +119,11 @@ public Environment withNetwork(@Nullable Network network) { return this; } - public Environment withSources(@Nullable List sources) { this.sources = sources; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -139,31 +133,33 @@ public boolean equals(java.lang.Object o) { return false; } Environment other = (Environment) o; - return - Utils.enhancedDeepEquals(this.environmentId, other.environmentId) && - Utils.enhancedDeepEquals(this.network, other.network) && - Utils.enhancedDeepEquals(this.sources, other.sources) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.environmentId, other.environmentId) + && Utils.enhancedDeepEquals(this.network, other.network) + && Utils.enhancedDeepEquals(this.sources, other.sources) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - environmentId, network, sources, - type); + return Utils.enhancedHash(environmentId, network, sources, type); } - + @Override public String toString() { - return Utils.toString(Environment.class, - "environmentId", environmentId, - "network", network, - "sources", sources, - "type", type); + return Utils.toString( + Environment.class, + "environmentId", + environmentId, + "network", + network, + "sources", + sources, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String environmentId; @@ -172,7 +168,7 @@ public final static class Builder { private List sources; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -198,15 +194,10 @@ public Builder sources(@Nullable List sources) { } public Environment build() { - return new Environment( - environmentId, network, sources); + return new Environment(environmentId, network, sources); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"remote\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"remote\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/EnvironmentEnum.java b/src/main/java/com/google/genai/gaos/models/interactions/EnvironmentEnum.java index a5d739f9a0e..0cff77c5bf3 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/EnvironmentEnum.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/EnvironmentEnum.java @@ -36,7 +36,7 @@ */ /** * EnvironmentEnum - * + * *

The environment being operated. */ public class EnvironmentEnum { @@ -60,12 +60,12 @@ private EnvironmentEnum(String value) { } /** - * Returns a EnvironmentEnum with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a EnvironmentEnum with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as EnvironmentEnum - */ + */ @JsonCreator public static EnvironmentEnum of(String value) { synchronized (EnvironmentEnum.class) { @@ -93,12 +93,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; EnvironmentEnum other = (EnvironmentEnum) obj; return Objects.equals(value, other.value); } @@ -130,13 +127,13 @@ private static final Map createEnumsMap() { map.put("desktop", EnvironmentEnumEnum.DESKTOP); return map; } - - + public enum EnvironmentEnumEnum { BROWSER("browser"), MOBILE("mobile"), - DESKTOP("desktop"),; + DESKTOP("desktop"), + ; private final String value; @@ -149,4 +146,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/EnvironmentNetworkEgressAllowlist.java b/src/main/java/com/google/genai/gaos/models/interactions/EnvironmentNetworkEgressAllowlist.java index 9f1afa0fe01..69440a47c12 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/EnvironmentNetworkEgressAllowlist.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/EnvironmentNetworkEgressAllowlist.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -35,7 +35,7 @@ /** * EnvironmentNetworkEgressAllowlist - * + * *

Outbound networking configuration for the sandbox. Accepts an object with an 'allowlist' array to * restrict traffic, or the string 'disabled' to turn off all network access. Omit entirely to allow * all outbound traffic with no header injection. @@ -45,21 +45,23 @@ public class EnvironmentNetworkEgressAllowlist { @JsonValue private final TypedObject value; - + private EnvironmentNetworkEgressAllowlist(TypedObject value) { this.value = value; } public static EnvironmentNetworkEgressAllowlist of(Allowlist value) { Utils.checkNotNull(value, "value"); - return new EnvironmentNetworkEgressAllowlist(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new EnvironmentNetworkEgressAllowlist( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static EnvironmentNetworkEgressAllowlist of(Disabled value) { Utils.checkNotNull(value, "value"); - return new EnvironmentNetworkEgressAllowlist(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new EnvironmentNetworkEgressAllowlist( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code Allowlist}, * otherwise returns an empty {@link Optional}. @@ -72,7 +74,7 @@ public Optional allowlist() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code Disabled}, * otherwise returns an empty {@link Optional}. @@ -85,19 +87,19 @@ public Optional disabled() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -109,27 +111,26 @@ public boolean equals(java.lang.Object o) { EnvironmentNetworkEgressAllowlist other = (EnvironmentNetworkEgressAllowlist) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(EnvironmentNetworkEgressAllowlist.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + EnvironmentNetworkEgressAllowlist.class, + false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(EnvironmentNetworkEgressAllowlist.class, - "value", value); + return Utils.toString(EnvironmentNetworkEgressAllowlist.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Error.java b/src/main/java/com/google/genai/gaos/models/interactions/Error.java index a0d25a9a272..e71c8836d40 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Error.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Error.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -31,7 +31,7 @@ /** * Error - * + * *

Error message from an interaction. */ public class Error { @@ -50,13 +50,11 @@ public class Error { private String message; @JsonCreator - public Error( - @JsonProperty("code") @Nullable String code, - @JsonProperty("message") @Nullable String message) { + public Error(@JsonProperty("code") @Nullable String code, @JsonProperty("message") @Nullable String message) { this.code = code; this.message = message; } - + public Error() { this(null, null); } @@ -79,7 +77,6 @@ public static Builder builder() { return new Builder(); } - /** * A URI that identifies the error type. */ @@ -88,7 +85,6 @@ public Error withCode(@Nullable String code) { return this; } - /** * A human-readable error message. */ @@ -97,7 +93,6 @@ public Error withMessage(@Nullable String message) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -107,33 +102,28 @@ public boolean equals(java.lang.Object o) { return false; } Error other = (Error) o; - return - Utils.enhancedDeepEquals(this.code, other.code) && - Utils.enhancedDeepEquals(this.message, other.message); + return Utils.enhancedDeepEquals(this.code, other.code) && Utils.enhancedDeepEquals(this.message, other.message); } - + @Override public int hashCode() { - return Utils.enhancedHash( - code, message); + return Utils.enhancedHash(code, message); } - + @Override public String toString() { - return Utils.toString(Error.class, - "code", code, - "message", message); + return Utils.toString(Error.class, "code", code, "message", message); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String code; private String message; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -153,9 +143,7 @@ public Builder message(@Nullable String message) { } public Error build() { - return new Error( - code, message); + return new Error(code, message); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ErrorEvent.java b/src/main/java/com/google/genai/gaos/models/interactions/ErrorEvent.java index 705f0be28cd..2fa563f70cd 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ErrorEvent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ErrorEvent.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class ErrorEvent implements InteractionSSEEvent { /** * Error message from an interaction. @@ -48,19 +47,17 @@ public class ErrorEvent implements InteractionSSEEvent { @JsonProperty("event_id") private String eventId; - @JsonProperty("event_type") private String eventType; @JsonCreator public ErrorEvent( - @JsonProperty("error") @Nullable Error error, - @JsonProperty("event_id") @Nullable String eventId) { + @JsonProperty("error") @Nullable Error error, @JsonProperty("event_id") @Nullable String eventId) { this.error = error; this.eventId = eventId; this.eventType = Builder._SINGLETON_VALUE_EventType.value(); } - + public ErrorEvent() { this(null, null); } @@ -89,7 +86,6 @@ public static Builder builder() { return new Builder(); } - /** * Error message from an interaction. */ @@ -98,7 +94,6 @@ public ErrorEvent withError(@Nullable Error error) { return this; } - /** * The event_id token to be used to resume the interaction stream, from * this event. @@ -108,7 +103,6 @@ public ErrorEvent withEventId(@Nullable String eventId) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -118,35 +112,30 @@ public boolean equals(java.lang.Object o) { return false; } ErrorEvent other = (ErrorEvent) o; - return - Utils.enhancedDeepEquals(this.error, other.error) && - Utils.enhancedDeepEquals(this.eventId, other.eventId) && - Utils.enhancedDeepEquals(this.eventType, other.eventType); + return Utils.enhancedDeepEquals(this.error, other.error) + && Utils.enhancedDeepEquals(this.eventId, other.eventId) + && Utils.enhancedDeepEquals(this.eventType, other.eventType); } - + @Override public int hashCode() { - return Utils.enhancedHash( - error, eventId, eventType); + return Utils.enhancedHash(error, eventId, eventType); } - + @Override public String toString() { - return Utils.toString(ErrorEvent.class, - "error", error, - "eventId", eventId, - "eventType", eventType); + return Utils.toString(ErrorEvent.class, "error", error, "eventId", eventId, "eventType", eventType); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Error error; private String eventId; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -167,15 +156,10 @@ public Builder eventId(@Nullable String eventId) { } public ErrorEvent build() { - return new ErrorEvent( - error, eventId); + return new ErrorEvent(error, eventId); } - private static final LazySingletonValue _SINGLETON_VALUE_EventType = - new LazySingletonValue<>( - "event_type", - "\"error\"", - new TypeReference() {}); + new LazySingletonValue<>("event_type", "\"error\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ExaAISearchConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/ExaAISearchConfig.java index 61769484133..c558a0acc83 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ExaAISearchConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ExaAISearchConfig.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nonnull; @@ -34,7 +34,7 @@ /** * ExaAISearchConfig - * + * *

Used to specify configuration for ExaAISearch. */ public class ExaAISearchConfig { @@ -55,13 +55,12 @@ public class ExaAISearchConfig { public ExaAISearchConfig( @JsonProperty("api_key") @Nonnull String apiKey, @JsonProperty("custom_config") @Nullable Map customConfig) { - this.apiKey = Optional.ofNullable(apiKey) - .orElseThrow(() -> new IllegalArgumentException("apiKey cannot be null")); + this.apiKey = + Optional.ofNullable(apiKey).orElseThrow(() -> new IllegalArgumentException("apiKey cannot be null")); this.customConfig = customConfig; } - - public ExaAISearchConfig( - @Nonnull String apiKey) { + + public ExaAISearchConfig(@Nonnull String apiKey) { this(apiKey, null); } @@ -83,7 +82,6 @@ public static Builder builder() { return new Builder(); } - /** * Required. The API key for ExaAiSearch. */ @@ -92,7 +90,6 @@ public ExaAISearchConfig withApiKey(@Nonnull String apiKey) { return this; } - /** * Optional. This field can be used to pass any parameter from the Exa.ai Search API. */ @@ -101,7 +98,6 @@ public ExaAISearchConfig withCustomConfig(@Nullable Map customCo return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -111,33 +107,29 @@ public boolean equals(java.lang.Object o) { return false; } ExaAISearchConfig other = (ExaAISearchConfig) o; - return - Utils.enhancedDeepEquals(this.apiKey, other.apiKey) && - Utils.enhancedDeepEquals(this.customConfig, other.customConfig); + return Utils.enhancedDeepEquals(this.apiKey, other.apiKey) + && Utils.enhancedDeepEquals(this.customConfig, other.customConfig); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiKey, customConfig); + return Utils.enhancedHash(apiKey, customConfig); } - + @Override public String toString() { - return Utils.toString(ExaAISearchConfig.class, - "apiKey", apiKey, - "customConfig", customConfig); + return Utils.toString(ExaAISearchConfig.class, "apiKey", apiKey, "customConfig", customConfig); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiKey; private Map customConfig; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -157,9 +149,7 @@ public Builder customConfig(@Nullable Map customConfig) { } public ExaAISearchConfig build() { - return new ExaAISearchConfig( - apiKey, customConfig); + return new ExaAISearchConfig(apiKey, customConfig); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FileCitation.java b/src/main/java/com/google/genai/gaos/models/interactions/FileCitation.java index 25384a05053..5da2d53bb80 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FileCitation.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FileCitation.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -36,7 +36,7 @@ /** * FileCitation - * + * *

A file citation annotation. */ public class FileCitation implements Annotation { @@ -91,14 +91,13 @@ public class FileCitation implements Annotation { /** * Start of segment of the response that is attributed to this source. - * + * *

Index indicates the start of the segment, measured in bytes. */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("start_index") private Integer startIndex; - @JsonProperty("type") private String type; @@ -122,11 +121,9 @@ public FileCitation( this.startIndex = startIndex; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public FileCitation() { - this(null, null, null, - null, null, null, - null, null); + this(null, null, null, null, null, null, null, null); } /** @@ -180,7 +177,7 @@ public Optional source() { /** * Start of segment of the response that is attributed to this source. - * + * *

Index indicates the start of the segment, measured in bytes. */ public Optional startIndex() { @@ -196,7 +193,6 @@ public static Builder builder() { return new Builder(); } - /** * User provided metadata about the retrieved context. */ @@ -205,7 +201,6 @@ public FileCitation withCustomMetadata(@Nullable Map customMetad return this; } - /** * The URI of the file. */ @@ -214,7 +209,6 @@ public FileCitation withDocumentUri(@Nullable String documentUri) { return this; } - /** * End of the attributed segment, exclusive. */ @@ -223,7 +217,6 @@ public FileCitation withEndIndex(@Nullable Integer endIndex) { return this; } - /** * The name of the file. */ @@ -232,7 +225,6 @@ public FileCitation withFileName(@Nullable String fileName) { return this; } - /** * Media ID in-case of image citations, if applicable. */ @@ -241,7 +233,6 @@ public FileCitation withMediaId(@Nullable String mediaId) { return this; } - /** * Page number of the cited document, if applicable. */ @@ -250,7 +241,6 @@ public FileCitation withPageNumber(@Nullable Integer pageNumber) { return this; } - /** * Source attributed for a portion of the text. */ @@ -259,10 +249,9 @@ public FileCitation withSource(@Nullable String source) { return this; } - /** * Start of segment of the response that is attributed to this source. - * + * *

Index indicates the start of the segment, measured in bytes. */ public FileCitation withStartIndex(@Nullable Integer startIndex) { @@ -270,7 +259,6 @@ public FileCitation withStartIndex(@Nullable Integer startIndex) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -280,42 +268,49 @@ public boolean equals(java.lang.Object o) { return false; } FileCitation other = (FileCitation) o; - return - Utils.enhancedDeepEquals(this.customMetadata, other.customMetadata) && - Utils.enhancedDeepEquals(this.documentUri, other.documentUri) && - Utils.enhancedDeepEquals(this.endIndex, other.endIndex) && - Utils.enhancedDeepEquals(this.fileName, other.fileName) && - Utils.enhancedDeepEquals(this.mediaId, other.mediaId) && - Utils.enhancedDeepEquals(this.pageNumber, other.pageNumber) && - Utils.enhancedDeepEquals(this.source, other.source) && - Utils.enhancedDeepEquals(this.startIndex, other.startIndex) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.customMetadata, other.customMetadata) + && Utils.enhancedDeepEquals(this.documentUri, other.documentUri) + && Utils.enhancedDeepEquals(this.endIndex, other.endIndex) + && Utils.enhancedDeepEquals(this.fileName, other.fileName) + && Utils.enhancedDeepEquals(this.mediaId, other.mediaId) + && Utils.enhancedDeepEquals(this.pageNumber, other.pageNumber) + && Utils.enhancedDeepEquals(this.source, other.source) + && Utils.enhancedDeepEquals(this.startIndex, other.startIndex) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { return Utils.enhancedHash( - customMetadata, documentUri, endIndex, - fileName, mediaId, pageNumber, - source, startIndex, type); + customMetadata, documentUri, endIndex, fileName, mediaId, pageNumber, source, startIndex, type); } - + @Override public String toString() { - return Utils.toString(FileCitation.class, - "customMetadata", customMetadata, - "documentUri", documentUri, - "endIndex", endIndex, - "fileName", fileName, - "mediaId", mediaId, - "pageNumber", pageNumber, - "source", source, - "startIndex", startIndex, - "type", type); + return Utils.toString( + FileCitation.class, + "customMetadata", + customMetadata, + "documentUri", + documentUri, + "endIndex", + endIndex, + "fileName", + fileName, + "mediaId", + mediaId, + "pageNumber", + pageNumber, + "source", + source, + "startIndex", + startIndex, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Map customMetadata; @@ -334,7 +329,7 @@ public final static class Builder { private Integer startIndex; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -395,7 +390,7 @@ public Builder source(@Nullable String source) { /** * Start of segment of the response that is attributed to this source. - * + * *

Index indicates the start of the segment, measured in bytes. */ public Builder startIndex(@Nullable Integer startIndex) { @@ -405,16 +400,10 @@ public Builder startIndex(@Nullable Integer startIndex) { public FileCitation build() { return new FileCitation( - customMetadata, documentUri, endIndex, - fileName, mediaId, pageNumber, - source, startIndex); + customMetadata, documentUri, endIndex, fileName, mediaId, pageNumber, source, startIndex); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"file_citation\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"file_citation\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FileContent.java b/src/main/java/com/google/genai/gaos/models/interactions/FileContent.java index 748b4a62792..4e797ae21f8 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FileContent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FileContent.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -31,7 +31,7 @@ /** * FileContent - * + * *

Content of a single file in the codebase. */ public class FileContent { @@ -50,13 +50,11 @@ public class FileContent { private String path; @JsonCreator - public FileContent( - @JsonProperty("content") @Nullable String content, - @JsonProperty("path") @Nullable String path) { + public FileContent(@JsonProperty("content") @Nullable String content, @JsonProperty("path") @Nullable String path) { this.content = content; this.path = path; } - + public FileContent() { this(null, null); } @@ -79,7 +77,6 @@ public static Builder builder() { return new Builder(); } - /** * The UTF-8 encoded text content of the file. */ @@ -88,7 +85,6 @@ public FileContent withContent(@Nullable String content) { return this; } - /** * The relative path of the file from the project root. */ @@ -97,7 +93,6 @@ public FileContent withPath(@Nullable String path) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -107,33 +102,28 @@ public boolean equals(java.lang.Object o) { return false; } FileContent other = (FileContent) o; - return - Utils.enhancedDeepEquals(this.content, other.content) && - Utils.enhancedDeepEquals(this.path, other.path); + return Utils.enhancedDeepEquals(this.content, other.content) && Utils.enhancedDeepEquals(this.path, other.path); } - + @Override public int hashCode() { - return Utils.enhancedHash( - content, path); + return Utils.enhancedHash(content, path); } - + @Override public String toString() { - return Utils.toString(FileContent.class, - "content", content, - "path", path); + return Utils.toString(FileContent.class, "content", content, "path", path); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String content; private String path; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -153,9 +143,7 @@ public Builder path(@Nullable String path) { } public FileContent build() { - return new FileContent( - content, path); + return new FileContent(content, path); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FileSearch.java b/src/main/java/com/google/genai/gaos/models/interactions/FileSearch.java index de397e59395..9b133582e01 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FileSearch.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FileSearch.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -35,7 +35,7 @@ /** * FileSearch - * + * *

A tool that can be used by the model to search files. */ public class FileSearch implements Tool { @@ -60,7 +60,6 @@ public class FileSearch implements Tool { @JsonProperty("top_k") private Integer topK; - @JsonProperty("type") private String type; @@ -74,7 +73,7 @@ public FileSearch( this.topK = topK; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public FileSearch() { this(null, null, null); } @@ -109,7 +108,6 @@ public static Builder builder() { return new Builder(); } - /** * The file search store names to search. */ @@ -118,7 +116,6 @@ public FileSearch withFileSearchStoreNames(@Nullable List fileSearchStor return this; } - /** * Metadata filter to apply to the semantic retrieval documents and chunks. */ @@ -127,7 +124,6 @@ public FileSearch withMetadataFilter(@Nullable String metadataFilter) { return this; } - /** * The number of semantic retrieval chunks to retrieve. */ @@ -136,7 +132,6 @@ public FileSearch withTopK(@Nullable Integer topK) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -146,31 +141,33 @@ public boolean equals(java.lang.Object o) { return false; } FileSearch other = (FileSearch) o; - return - Utils.enhancedDeepEquals(this.fileSearchStoreNames, other.fileSearchStoreNames) && - Utils.enhancedDeepEquals(this.metadataFilter, other.metadataFilter) && - Utils.enhancedDeepEquals(this.topK, other.topK) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.fileSearchStoreNames, other.fileSearchStoreNames) + && Utils.enhancedDeepEquals(this.metadataFilter, other.metadataFilter) + && Utils.enhancedDeepEquals(this.topK, other.topK) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - fileSearchStoreNames, metadataFilter, topK, - type); + return Utils.enhancedHash(fileSearchStoreNames, metadataFilter, topK, type); } - + @Override public String toString() { - return Utils.toString(FileSearch.class, - "fileSearchStoreNames", fileSearchStoreNames, - "metadataFilter", metadataFilter, - "topK", topK, - "type", type); + return Utils.toString( + FileSearch.class, + "fileSearchStoreNames", + fileSearchStoreNames, + "metadataFilter", + metadataFilter, + "topK", + topK, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List fileSearchStoreNames; @@ -179,7 +176,7 @@ public final static class Builder { private Integer topK; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -207,15 +204,10 @@ public Builder topK(@Nullable Integer topK) { } public FileSearch build() { - return new FileSearch( - fileSearchStoreNames, metadataFilter, topK); + return new FileSearch(fileSearchStoreNames, metadataFilter, topK); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"file_search\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"file_search\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FileSearchCallDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/FileSearchCallDelta.java index 4c357eadf4d..98962f76c22 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FileSearchCallDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FileSearchCallDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class FileSearchCallDelta implements StepDeltaData { /** * A signature hash for backend validation. @@ -40,17 +39,15 @@ public class FileSearchCallDelta implements StepDeltaData { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @JsonCreator - public FileSearchCallDelta( - @JsonProperty("signature") @Nullable String signature) { + public FileSearchCallDelta(@JsonProperty("signature") @Nullable String signature) { this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public FileSearchCallDelta() { this(null); } @@ -71,7 +68,6 @@ public static Builder builder() { return new Builder(); } - /** * A signature hash for backend validation. */ @@ -80,7 +76,6 @@ public FileSearchCallDelta withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -90,31 +85,27 @@ public boolean equals(java.lang.Object o) { return false; } FileSearchCallDelta other = (FileSearchCallDelta) o; - return - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - signature, type); + return Utils.enhancedHash(signature, type); } - + @Override public String toString() { - return Utils.toString(FileSearchCallDelta.class, - "signature", signature, - "type", type); + return Utils.toString(FileSearchCallDelta.class, "signature", signature, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -126,15 +117,10 @@ public Builder signature(@Nullable String signature) { } public FileSearchCallDelta build() { - return new FileSearchCallDelta( - signature); + return new FileSearchCallDelta(signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"file_search_call\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"file_search_call\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FileSearchCallStep.java b/src/main/java/com/google/genai/gaos/models/interactions/FileSearchCallStep.java index 14a205522c9..4c9674aa902 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FileSearchCallStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FileSearchCallStep.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * FileSearchCallStep - * + * *

File Search call step. */ public class FileSearchCallStep implements Step { @@ -51,22 +51,18 @@ public class FileSearchCallStep implements Step { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @JsonCreator public FileSearchCallStep( - @JsonProperty("id") @Nonnull String id, - @JsonProperty("signature") @Nullable String signature) { - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + @JsonProperty("id") @Nonnull String id, @JsonProperty("signature") @Nullable String signature) { + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public FileSearchCallStep( - @Nonnull String id) { + + public FileSearchCallStep(@Nonnull String id) { this(id, null); } @@ -93,7 +89,6 @@ public static Builder builder() { return new Builder(); } - /** * Required. A unique ID for this specific tool call. */ @@ -102,7 +97,6 @@ public FileSearchCallStep withId(@Nonnull String id) { return this; } - /** * A signature hash for backend validation. */ @@ -111,7 +105,6 @@ public FileSearchCallStep withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -121,35 +114,30 @@ public boolean equals(java.lang.Object o) { return false; } FileSearchCallStep other = (FileSearchCallStep) o; - return - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - id, signature, type); + return Utils.enhancedHash(id, signature, type); } - + @Override public String toString() { - return Utils.toString(FileSearchCallStep.class, - "id", id, - "signature", signature, - "type", type); + return Utils.toString(FileSearchCallStep.class, "id", id, "signature", signature, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String id; private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -169,15 +157,10 @@ public Builder signature(@Nullable String signature) { } public FileSearchCallStep build() { - return new FileSearchCallStep( - id, signature); + return new FileSearchCallStep(id, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"file_search_call\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"file_search_call\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FileSearchResult.java b/src/main/java/com/google/genai/gaos/models/interactions/FileSearchResult.java index a9cb08b4e31..46cfaec7612 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FileSearchResult.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FileSearchResult.java @@ -26,19 +26,17 @@ /** * FileSearchResult - * + * *

The result of the File Search. */ public class FileSearchResult { @JsonCreator - public FileSearchResult() { - } + public FileSearchResult() {} public static Builder builder() { return new Builder(); } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -49,29 +47,26 @@ public boolean equals(java.lang.Object o) { } return true; } - + @Override public int hashCode() { - return Utils.enhancedHash( - ); + return Utils.enhancedHash(); } - + @Override public String toString() { return Utils.toString(FileSearchResult.class); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Builder() { - // force use of static builder() method + // force use of static builder() method } public FileSearchResult build() { - return new FileSearchResult( - ); + return new FileSearchResult(); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FileSearchResultDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/FileSearchResultDelta.java index e06a4e2cce3..b0b8ded69c0 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FileSearchResultDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FileSearchResultDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -33,7 +33,6 @@ import java.util.List; import java.util.Optional; - public class FileSearchResultDelta implements StepDeltaData { @JsonProperty("result") @@ -46,7 +45,6 @@ public class FileSearchResultDelta implements StepDeltaData { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -54,14 +52,13 @@ public class FileSearchResultDelta implements StepDeltaData { public FileSearchResultDelta( @JsonProperty("result") @Nonnull List result, @JsonProperty("signature") @Nullable String signature) { - this.result = Optional.ofNullable(result) - .orElseThrow(() -> new IllegalArgumentException("result cannot be null")); + this.result = + Optional.ofNullable(result).orElseThrow(() -> new IllegalArgumentException("result cannot be null")); this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public FileSearchResultDelta( - @Nonnull List result) { + + public FileSearchResultDelta(@Nonnull List result) { this(result, null); } @@ -85,13 +82,11 @@ public static Builder builder() { return new Builder(); } - public FileSearchResultDelta withResult(@Nonnull List result) { this.result = Utils.checkNotNull(result, "result"); return this; } - /** * A signature hash for backend validation. */ @@ -100,7 +95,6 @@ public FileSearchResultDelta withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -110,35 +104,30 @@ public boolean equals(java.lang.Object o) { return false; } FileSearchResultDelta other = (FileSearchResultDelta) o; - return - Utils.enhancedDeepEquals(this.result, other.result) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.result, other.result) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - result, signature, type); + return Utils.enhancedHash(result, signature, type); } - + @Override public String toString() { - return Utils.toString(FileSearchResultDelta.class, - "result", result, - "signature", signature, - "type", type); + return Utils.toString(FileSearchResultDelta.class, "result", result, "signature", signature, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List result; private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder result(@Nonnull List result) { @@ -155,15 +144,10 @@ public Builder signature(@Nullable String signature) { } public FileSearchResultDelta build() { - return new FileSearchResultDelta( - result, signature); + return new FileSearchResultDelta(result, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"file_search_result\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"file_search_result\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FileSearchResultStep.java b/src/main/java/com/google/genai/gaos/models/interactions/FileSearchResultStep.java index 9a3cd20ea7a..90aafa8fbbd 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FileSearchResultStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FileSearchResultStep.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * FileSearchResultStep - * + * *

File Search result step. */ public class FileSearchResultStep implements Step { @@ -51,22 +51,19 @@ public class FileSearchResultStep implements Step { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @JsonCreator public FileSearchResultStep( - @JsonProperty("call_id") @Nonnull String callId, - @JsonProperty("signature") @Nullable String signature) { - this.callId = Optional.ofNullable(callId) - .orElseThrow(() -> new IllegalArgumentException("callId cannot be null")); + @JsonProperty("call_id") @Nonnull String callId, @JsonProperty("signature") @Nullable String signature) { + this.callId = + Optional.ofNullable(callId).orElseThrow(() -> new IllegalArgumentException("callId cannot be null")); this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public FileSearchResultStep( - @Nonnull String callId) { + + public FileSearchResultStep(@Nonnull String callId) { this(callId, null); } @@ -93,7 +90,6 @@ public static Builder builder() { return new Builder(); } - /** * Required. ID to match the ID from the function call block. */ @@ -102,7 +98,6 @@ public FileSearchResultStep withCallId(@Nonnull String callId) { return this; } - /** * A signature hash for backend validation. */ @@ -111,7 +106,6 @@ public FileSearchResultStep withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -121,35 +115,30 @@ public boolean equals(java.lang.Object o) { return false; } FileSearchResultStep other = (FileSearchResultStep) o; - return - Utils.enhancedDeepEquals(this.callId, other.callId) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.callId, other.callId) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - callId, signature, type); + return Utils.enhancedHash(callId, signature, type); } - + @Override public String toString() { - return Utils.toString(FileSearchResultStep.class, - "callId", callId, - "signature", signature, - "type", type); + return Utils.toString(FileSearchResultStep.class, "callId", callId, "signature", signature, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String callId; private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -169,15 +158,10 @@ public Builder signature(@Nullable String signature) { } public FileSearchResultStep build() { - return new FileSearchResultStep( - callId, signature); + return new FileSearchResultStep(callId, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"file_search_result\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"file_search_result\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Filter.java b/src/main/java/com/google/genai/gaos/models/interactions/Filter.java index 858278613e5..e118fdbdb56 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Filter.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Filter.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * Filter - * + * *

Config for filters. */ public class Filter { @@ -68,7 +68,7 @@ public Filter( this.vectorDistanceThreshold = vectorDistanceThreshold; this.vectorSimilarityThreshold = vectorSimilarityThreshold; } - + public Filter() { this(null, null, null); } @@ -100,7 +100,6 @@ public static Builder builder() { return new Builder(); } - /** * Optional. String for metadata filtering. */ @@ -109,7 +108,6 @@ public Filter withMetadataFilter(@Nullable String metadataFilter) { return this; } - /** * Optional. Only returns contexts with vector distance smaller than the * threshold. @@ -119,7 +117,6 @@ public Filter withVectorDistanceThreshold(@Nullable Double vectorDistanceThresho return this; } - /** * Optional. Only returns contexts with vector similarity larger than the * threshold. @@ -129,7 +126,6 @@ public Filter withVectorSimilarityThreshold(@Nullable Double vectorSimilarityThr return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -139,28 +135,30 @@ public boolean equals(java.lang.Object o) { return false; } Filter other = (Filter) o; - return - Utils.enhancedDeepEquals(this.metadataFilter, other.metadataFilter) && - Utils.enhancedDeepEquals(this.vectorDistanceThreshold, other.vectorDistanceThreshold) && - Utils.enhancedDeepEquals(this.vectorSimilarityThreshold, other.vectorSimilarityThreshold); + return Utils.enhancedDeepEquals(this.metadataFilter, other.metadataFilter) + && Utils.enhancedDeepEquals(this.vectorDistanceThreshold, other.vectorDistanceThreshold) + && Utils.enhancedDeepEquals(this.vectorSimilarityThreshold, other.vectorSimilarityThreshold); } - + @Override public int hashCode() { - return Utils.enhancedHash( - metadataFilter, vectorDistanceThreshold, vectorSimilarityThreshold); + return Utils.enhancedHash(metadataFilter, vectorDistanceThreshold, vectorSimilarityThreshold); } - + @Override public String toString() { - return Utils.toString(Filter.class, - "metadataFilter", metadataFilter, - "vectorDistanceThreshold", vectorDistanceThreshold, - "vectorSimilarityThreshold", vectorSimilarityThreshold); + return Utils.toString( + Filter.class, + "metadataFilter", + metadataFilter, + "vectorDistanceThreshold", + vectorDistanceThreshold, + "vectorSimilarityThreshold", + vectorSimilarityThreshold); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String metadataFilter; @@ -169,7 +167,7 @@ public final static class Builder { private Double vectorSimilarityThreshold; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -199,9 +197,7 @@ public Builder vectorSimilarityThreshold(@Nullable Double vectorSimilarityThresh } public Filter build() { - return new Filter( - metadataFilter, vectorDistanceThreshold, vectorSimilarityThreshold); + return new Filter(metadataFilter, vectorDistanceThreshold, vectorSimilarityThreshold); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FindRequest.java b/src/main/java/com/google/genai/gaos/models/interactions/FindRequest.java index 5d1795aed37..870f0120dc4 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FindRequest.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FindRequest.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * FindRequest - * + * *

Request parameters specific to FIND sessions, used for discovering * vulnerabilities in a codebase. */ @@ -79,10 +79,9 @@ public FindRequest( this.mode = mode; this.sourceFiles = sourceFiles; } - + public FindRequest() { - this(null, null, null, - null); + this(null, null, null, null); } /** @@ -120,7 +119,6 @@ public static Builder builder() { return new Builder(); } - /** * Additional context or custom instructions provided by the user to guide * the vulnerability analysis. @@ -130,7 +128,6 @@ public FindRequest withDescription(@Nullable String description) { return this; } - /** * The identifier of a specific finding to verify. This is primarily used in * VERIFY mode to focus the agent's execution-based validation on a single @@ -141,7 +138,6 @@ public FindRequest withFindingId(@Nullable String findingId) { return this; } - /** * The mode of the find session. */ @@ -150,7 +146,6 @@ public FindRequest withMode(@Nullable Mode mode) { return this; } - /** * A list of source files to provide as context for the scan. */ @@ -159,7 +154,6 @@ public FindRequest withSourceFiles(@Nullable List sourceFiles) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -169,31 +163,33 @@ public boolean equals(java.lang.Object o) { return false; } FindRequest other = (FindRequest) o; - return - Utils.enhancedDeepEquals(this.description, other.description) && - Utils.enhancedDeepEquals(this.findingId, other.findingId) && - Utils.enhancedDeepEquals(this.mode, other.mode) && - Utils.enhancedDeepEquals(this.sourceFiles, other.sourceFiles); + return Utils.enhancedDeepEquals(this.description, other.description) + && Utils.enhancedDeepEquals(this.findingId, other.findingId) + && Utils.enhancedDeepEquals(this.mode, other.mode) + && Utils.enhancedDeepEquals(this.sourceFiles, other.sourceFiles); } - + @Override public int hashCode() { - return Utils.enhancedHash( - description, findingId, mode, - sourceFiles); + return Utils.enhancedHash(description, findingId, mode, sourceFiles); } - + @Override public String toString() { - return Utils.toString(FindRequest.class, - "description", description, - "findingId", findingId, - "mode", mode, - "sourceFiles", sourceFiles); + return Utils.toString( + FindRequest.class, + "description", + description, + "findingId", + findingId, + "mode", + mode, + "sourceFiles", + sourceFiles); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String description; @@ -204,7 +200,7 @@ public final static class Builder { private List sourceFiles; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -243,10 +239,7 @@ public Builder sourceFiles(@Nullable List sourceFiles) { } public FindRequest build() { - return new FindRequest( - description, findingId, mode, - sourceFiles); + return new FindRequest(description, findingId, mode, sourceFiles); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FixRequest.java b/src/main/java/com/google/genai/gaos/models/interactions/FixRequest.java index fa0721e3db7..108b115450b 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FixRequest.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FixRequest.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * FixRequest - * + * *

Request parameters specific to FIX sessions, used for generating and * validating security patches. */ @@ -70,7 +70,7 @@ public FixRequest( this.findingId = findingId; this.sourceFiles = sourceFiles; } - + public FixRequest() { this(null, null, null); } @@ -103,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * Additional context or custom instructions provided by the user to guide * the patch generation process. @@ -113,7 +112,6 @@ public FixRequest withDescription(@Nullable String description) { return this; } - /** * The identifier of the specific security finding to be remediated. This ID * maps to a previously discovered vulnerability. @@ -123,7 +121,6 @@ public FixRequest withFindingId(@Nullable String findingId) { return this; } - /** * A list of source files providing context for the remediation. These files * are typically the ones containing the identified vulnerability. @@ -133,7 +130,6 @@ public FixRequest withSourceFiles(@Nullable List sourceFiles) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -143,28 +139,24 @@ public boolean equals(java.lang.Object o) { return false; } FixRequest other = (FixRequest) o; - return - Utils.enhancedDeepEquals(this.description, other.description) && - Utils.enhancedDeepEquals(this.findingId, other.findingId) && - Utils.enhancedDeepEquals(this.sourceFiles, other.sourceFiles); + return Utils.enhancedDeepEquals(this.description, other.description) + && Utils.enhancedDeepEquals(this.findingId, other.findingId) + && Utils.enhancedDeepEquals(this.sourceFiles, other.sourceFiles); } - + @Override public int hashCode() { - return Utils.enhancedHash( - description, findingId, sourceFiles); + return Utils.enhancedHash(description, findingId, sourceFiles); } - + @Override public String toString() { - return Utils.toString(FixRequest.class, - "description", description, - "findingId", findingId, - "sourceFiles", sourceFiles); + return Utils.toString( + FixRequest.class, "description", description, "findingId", findingId, "sourceFiles", sourceFiles); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String description; @@ -173,7 +165,7 @@ public final static class Builder { private List sourceFiles; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -204,9 +196,7 @@ public Builder sourceFiles(@Nullable List sourceFiles) { } public FixRequest build() { - return new FixRequest( - description, findingId, sourceFiles); + return new FixRequest(description, findingId, sourceFiles); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Function.java b/src/main/java/com/google/genai/gaos/models/interactions/Function.java index df2a523d1f5..c34a0168655 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Function.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Function.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.models.agents.AgentTool; @@ -35,7 +35,7 @@ /** * Function - * + * *

A tool that can be used by the model. */ public class Function implements Tool, AgentTool { @@ -60,7 +60,6 @@ public class Function implements Tool, AgentTool { @JsonProperty("parameters") private Object parameters; - @JsonProperty("type") private String type; @@ -74,7 +73,7 @@ public Function( this.parameters = parameters; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public Function() { this(null, null, null); } @@ -109,7 +108,6 @@ public static Builder builder() { return new Builder(); } - /** * A description of the function. */ @@ -118,7 +116,6 @@ public Function withDescription(@Nullable String description) { return this; } - /** * The name of the function. */ @@ -127,7 +124,6 @@ public Function withName(@Nullable String name) { return this; } - /** * The JSON Schema for the function's parameters. */ @@ -136,7 +132,6 @@ public Function withParameters(@Nullable Object parameters) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -146,31 +141,25 @@ public boolean equals(java.lang.Object o) { return false; } Function other = (Function) o; - return - Utils.enhancedDeepEquals(this.description, other.description) && - Utils.enhancedDeepEquals(this.name, other.name) && - Utils.enhancedDeepEquals(this.parameters, other.parameters) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.description, other.description) + && Utils.enhancedDeepEquals(this.name, other.name) + && Utils.enhancedDeepEquals(this.parameters, other.parameters) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - description, name, parameters, - type); + return Utils.enhancedHash(description, name, parameters, type); } - + @Override public String toString() { - return Utils.toString(Function.class, - "description", description, - "name", name, - "parameters", parameters, - "type", type); + return Utils.toString( + Function.class, "description", description, "name", name, "parameters", parameters, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String description; @@ -179,7 +168,7 @@ public final static class Builder { private Object parameters; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -207,15 +196,10 @@ public Builder parameters(@Nullable Object parameters) { } public Function build() { - return new Function( - description, name, parameters); + return new Function(description, name, parameters); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"function\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"function\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FunctionCallStep.java b/src/main/java/com/google/genai/gaos/models/interactions/FunctionCallStep.java index 37e9f327546..72cee1b73d5 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FunctionCallStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FunctionCallStep.java @@ -33,7 +33,7 @@ /** * FunctionCallStep - * + * *

A function tool call step. */ public class FunctionCallStep implements Step { @@ -55,7 +55,6 @@ public class FunctionCallStep implements Step { @JsonProperty("name") private String name; - @JsonProperty("type") private String type; @@ -66,11 +65,9 @@ public FunctionCallStep( @JsonProperty("name") @Nonnull String name) { arguments = Utils.emptyMapIfNull(arguments); this.arguments = Optional.ofNullable(arguments) - .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); - this.name = Optional.ofNullable(name) - .orElseThrow(() -> new IllegalArgumentException("name cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.name = Optional.ofNullable(name).orElseThrow(() -> new IllegalArgumentException("name cannot be null")); this.type = Builder._SINGLETON_VALUE_Type.value(); } @@ -104,7 +101,6 @@ public static Builder builder() { return new Builder(); } - /** * Required. The arguments to pass to the function. */ @@ -113,7 +109,6 @@ public FunctionCallStep withArguments(@Nonnull Map arguments) { return this; } - /** * Required. A unique ID for this specific tool call. */ @@ -122,7 +117,6 @@ public FunctionCallStep withId(@Nonnull String id) { return this; } - /** * Required. The name of the tool to call. */ @@ -131,7 +125,6 @@ public FunctionCallStep withName(@Nonnull String name) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -141,31 +134,24 @@ public boolean equals(java.lang.Object o) { return false; } FunctionCallStep other = (FunctionCallStep) o; - return - Utils.enhancedDeepEquals(this.arguments, other.arguments) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.name, other.name) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.arguments, other.arguments) + && Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.name, other.name) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - arguments, id, name, - type); + return Utils.enhancedHash(arguments, id, name, type); } - + @Override public String toString() { - return Utils.toString(FunctionCallStep.class, - "arguments", arguments, - "id", id, - "name", name, - "type", type); + return Utils.toString(FunctionCallStep.class, "arguments", arguments, "id", id, "name", name, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Map arguments; @@ -174,7 +160,7 @@ public final static class Builder { private String name; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -202,15 +188,10 @@ public Builder name(@Nonnull String name) { } public FunctionCallStep build() { - return new FunctionCallStep( - arguments, id, name); + return new FunctionCallStep(arguments, id, name); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"function_call\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"function_call\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultDelta.java index d81f5428903..b4816c35e60 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -33,7 +33,6 @@ import java.lang.String; import java.util.Optional; - public class FunctionResultDelta implements StepDeltaData { /** * Required. ID to match the ID from the function call block. @@ -41,21 +40,17 @@ public class FunctionResultDelta implements StepDeltaData { @JsonProperty("call_id") private String callId; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("is_error") private Boolean isError; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("name") private String name; - @JsonProperty("result") private FunctionResultDeltaResultUnion result; - @JsonProperty("type") private String type; @@ -65,20 +60,17 @@ public FunctionResultDelta( @JsonProperty("is_error") @Nullable Boolean isError, @JsonProperty("name") @Nullable String name, @JsonProperty("result") @Nonnull FunctionResultDeltaResultUnion result) { - this.callId = Optional.ofNullable(callId) - .orElseThrow(() -> new IllegalArgumentException("callId cannot be null")); + this.callId = + Optional.ofNullable(callId).orElseThrow(() -> new IllegalArgumentException("callId cannot be null")); this.isError = isError; this.name = name; - this.result = Optional.ofNullable(result) - .orElseThrow(() -> new IllegalArgumentException("result cannot be null")); + this.result = + Optional.ofNullable(result).orElseThrow(() -> new IllegalArgumentException("result cannot be null")); this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public FunctionResultDelta( - @Nonnull String callId, - @Nonnull FunctionResultDeltaResultUnion result) { - this(callId, null, null, - result); + + public FunctionResultDelta(@Nonnull String callId, @Nonnull FunctionResultDeltaResultUnion result) { + this(callId, null, null, result); } /** @@ -109,7 +101,6 @@ public static Builder builder() { return new Builder(); } - /** * Required. ID to match the ID from the function call block. */ @@ -118,25 +109,21 @@ public FunctionResultDelta withCallId(@Nonnull String callId) { return this; } - public FunctionResultDelta withIsError(@Nullable Boolean isError) { this.isError = isError; return this; } - public FunctionResultDelta withName(@Nullable String name) { this.name = name; return this; } - public FunctionResultDelta withResult(@Nonnull FunctionResultDeltaResultUnion result) { this.result = Utils.checkNotNull(result, "result"); return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -146,33 +133,36 @@ public boolean equals(java.lang.Object o) { return false; } FunctionResultDelta other = (FunctionResultDelta) o; - return - Utils.enhancedDeepEquals(this.callId, other.callId) && - Utils.enhancedDeepEquals(this.isError, other.isError) && - Utils.enhancedDeepEquals(this.name, other.name) && - Utils.enhancedDeepEquals(this.result, other.result) && - Utils.enhancedDeepEquals(this.type, other.type); - } - + return Utils.enhancedDeepEquals(this.callId, other.callId) + && Utils.enhancedDeepEquals(this.isError, other.isError) + && Utils.enhancedDeepEquals(this.name, other.name) + && Utils.enhancedDeepEquals(this.result, other.result) + && Utils.enhancedDeepEquals(this.type, other.type); + } + @Override public int hashCode() { - return Utils.enhancedHash( - callId, isError, name, - result, type); + return Utils.enhancedHash(callId, isError, name, result, type); } - + @Override public String toString() { - return Utils.toString(FunctionResultDelta.class, - "callId", callId, - "isError", isError, - "name", name, - "result", result, - "type", type); + return Utils.toString( + FunctionResultDelta.class, + "callId", + callId, + "isError", + isError, + "name", + name, + "result", + result, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String callId; @@ -183,7 +173,7 @@ public final static class Builder { private FunctionResultDeltaResultUnion result; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -210,16 +200,10 @@ public Builder result(@Nonnull FunctionResultDeltaResultUnion result) { } public FunctionResultDelta build() { - return new FunctionResultDelta( - callId, isError, name, - result); + return new FunctionResultDelta(callId, isError, name, result); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"function_result\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"function_result\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultDeltaResult.java b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultDeltaResult.java index 18a8a304d7a..6bb241a4d59 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultDeltaResult.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultDeltaResult.java @@ -24,17 +24,14 @@ import java.lang.Override; import java.lang.String; - public class FunctionResultDeltaResult { @JsonCreator - public FunctionResultDeltaResult() { - } + public FunctionResultDeltaResult() {} public static Builder builder() { return new Builder(); } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -45,29 +42,26 @@ public boolean equals(java.lang.Object o) { } return true; } - + @Override public int hashCode() { - return Utils.enhancedHash( - ); + return Utils.enhancedHash(); } - + @Override public String toString() { return Utils.toString(FunctionResultDeltaResult.class); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Builder() { - // force use of static builder() method + // force use of static builder() method } public FunctionResultDeltaResult build() { - return new FunctionResultDeltaResult( - ); + return new FunctionResultDeltaResult(); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultDeltaResultUnion.java b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultDeltaResultUnion.java index e4fc1f257af..c8b86f9be14 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultDeltaResultUnion.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultDeltaResultUnion.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -39,26 +39,29 @@ public class FunctionResultDeltaResultUnion { @JsonValue private final TypedObject value; - + private FunctionResultDeltaResultUnion(TypedObject value) { this.value = value; } public static FunctionResultDeltaResultUnion of(FunctionResultDeltaResult value) { Utils.checkNotNull(value, "value"); - return new FunctionResultDeltaResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new FunctionResultDeltaResultUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static FunctionResultDeltaResultUnion of(List value) { Utils.checkNotNull(value, "value"); - return new FunctionResultDeltaResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new FunctionResultDeltaResultUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>() {})); } public static FunctionResultDeltaResultUnion of(String value) { Utils.checkNotNull(value, "value"); - return new FunctionResultDeltaResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new FunctionResultDeltaResultUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code FunctionResultDeltaResult}, * otherwise returns an empty {@link Optional}. @@ -71,7 +74,7 @@ public Optional functionResultDeltaResult() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code List}, * otherwise returns an empty {@link Optional}. @@ -85,7 +88,7 @@ public Optional> arrayOfFunctionResultSubcontent( } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code String}, * otherwise returns an empty {@link Optional}. @@ -98,19 +101,19 @@ public Optional string() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -122,28 +125,28 @@ public boolean equals(java.lang.Object o) { FunctionResultDeltaResultUnion other = (FunctionResultDeltaResultUnion) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(FunctionResultDeltaResultUnion.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + FunctionResultDeltaResultUnion.class, + false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of( + new TypeReference>() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(FunctionResultDeltaResultUnion.class, - "value", value); + return Utils.toString(FunctionResultDeltaResultUnion.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultStep.java b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultStep.java index 1f8713dd83d..c7ef4549d2c 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultStep.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -35,7 +35,7 @@ /** * FunctionResultStep - * + * *

Result of a function tool call. */ public class FunctionResultStep implements Step { @@ -65,7 +65,6 @@ public class FunctionResultStep implements Step { @JsonProperty("result") private FunctionResultStepResultUnion result; - @JsonProperty("type") private String type; @@ -75,20 +74,17 @@ public FunctionResultStep( @JsonProperty("is_error") @Nullable Boolean isError, @JsonProperty("name") @Nullable String name, @JsonProperty("result") @Nonnull FunctionResultStepResultUnion result) { - this.callId = Optional.ofNullable(callId) - .orElseThrow(() -> new IllegalArgumentException("callId cannot be null")); + this.callId = + Optional.ofNullable(callId).orElseThrow(() -> new IllegalArgumentException("callId cannot be null")); this.isError = isError; this.name = name; - this.result = Optional.ofNullable(result) - .orElseThrow(() -> new IllegalArgumentException("result cannot be null")); + this.result = + Optional.ofNullable(result).orElseThrow(() -> new IllegalArgumentException("result cannot be null")); this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public FunctionResultStep( - @Nonnull String callId, - @Nonnull FunctionResultStepResultUnion result) { - this(callId, null, null, - result); + + public FunctionResultStep(@Nonnull String callId, @Nonnull FunctionResultStepResultUnion result) { + this(callId, null, null, result); } /** @@ -128,7 +124,6 @@ public static Builder builder() { return new Builder(); } - /** * Required. ID to match the ID from the function call block. */ @@ -137,7 +132,6 @@ public FunctionResultStep withCallId(@Nonnull String callId) { return this; } - /** * Whether the tool call resulted in an error. */ @@ -146,7 +140,6 @@ public FunctionResultStep withIsError(@Nullable Boolean isError) { return this; } - /** * The name of the tool that was called. */ @@ -155,7 +148,6 @@ public FunctionResultStep withName(@Nullable String name) { return this; } - /** * Required. The result of the tool call. */ @@ -164,7 +156,6 @@ public FunctionResultStep withResult(@Nonnull FunctionResultStepResultUnion resu return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -174,33 +165,36 @@ public boolean equals(java.lang.Object o) { return false; } FunctionResultStep other = (FunctionResultStep) o; - return - Utils.enhancedDeepEquals(this.callId, other.callId) && - Utils.enhancedDeepEquals(this.isError, other.isError) && - Utils.enhancedDeepEquals(this.name, other.name) && - Utils.enhancedDeepEquals(this.result, other.result) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.callId, other.callId) + && Utils.enhancedDeepEquals(this.isError, other.isError) + && Utils.enhancedDeepEquals(this.name, other.name) + && Utils.enhancedDeepEquals(this.result, other.result) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - callId, isError, name, - result, type); + return Utils.enhancedHash(callId, isError, name, result, type); } - + @Override public String toString() { - return Utils.toString(FunctionResultStep.class, - "callId", callId, - "isError", isError, - "name", name, - "result", result, - "type", type); + return Utils.toString( + FunctionResultStep.class, + "callId", + callId, + "isError", + isError, + "name", + name, + "result", + result, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String callId; @@ -211,7 +205,7 @@ public final static class Builder { private FunctionResultStepResultUnion result; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -247,16 +241,10 @@ public Builder result(@Nonnull FunctionResultStepResultUnion result) { } public FunctionResultStep build() { - return new FunctionResultStep( - callId, isError, name, - result); + return new FunctionResultStep(callId, isError, name, result); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"function_result\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"function_result\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultStepResult.java b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultStepResult.java index a70d4d3ca9d..ac2a9599916 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultStepResult.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultStepResult.java @@ -24,17 +24,14 @@ import java.lang.Override; import java.lang.String; - public class FunctionResultStepResult { @JsonCreator - public FunctionResultStepResult() { - } + public FunctionResultStepResult() {} public static Builder builder() { return new Builder(); } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -45,29 +42,26 @@ public boolean equals(java.lang.Object o) { } return true; } - + @Override public int hashCode() { - return Utils.enhancedHash( - ); + return Utils.enhancedHash(); } - + @Override public String toString() { return Utils.toString(FunctionResultStepResult.class); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Builder() { - // force use of static builder() method + // force use of static builder() method } public FunctionResultStepResult build() { - return new FunctionResultStepResult( - ); + return new FunctionResultStepResult(); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultStepResultUnion.java b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultStepResultUnion.java index b1195389bf4..4feebac108c 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultStepResultUnion.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultStepResultUnion.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -36,7 +36,7 @@ /** * FunctionResultStepResultUnion - * + * *

Required. The result of the tool call. */ @JsonDeserialize(using = FunctionResultStepResultUnion._Deserializer.class) @@ -44,26 +44,29 @@ public class FunctionResultStepResultUnion { @JsonValue private final TypedObject value; - + private FunctionResultStepResultUnion(TypedObject value) { this.value = value; } public static FunctionResultStepResultUnion of(FunctionResultStepResult value) { Utils.checkNotNull(value, "value"); - return new FunctionResultStepResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new FunctionResultStepResultUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static FunctionResultStepResultUnion of(List value) { Utils.checkNotNull(value, "value"); - return new FunctionResultStepResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new FunctionResultStepResultUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>() {})); } public static FunctionResultStepResultUnion of(String value) { Utils.checkNotNull(value, "value"); - return new FunctionResultStepResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new FunctionResultStepResultUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code FunctionResultStepResult}, * otherwise returns an empty {@link Optional}. @@ -76,7 +79,7 @@ public Optional functionResultStepResult() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code List}, * otherwise returns an empty {@link Optional}. @@ -90,7 +93,7 @@ public Optional> arrayOfFunctionResultSubcontent( } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code String}, * otherwise returns an empty {@link Optional}. @@ -103,19 +106,19 @@ public Optional string() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -127,28 +130,28 @@ public boolean equals(java.lang.Object o) { FunctionResultStepResultUnion other = (FunctionResultStepResultUnion) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(FunctionResultStepResultUnion.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + FunctionResultStepResultUnion.class, + false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of( + new TypeReference>() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(FunctionResultStepResultUnion.class, - "value", value); + return Utils.toString(FunctionResultStepResultUnion.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultSubcontent.java b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultSubcontent.java index ed196a48707..a0eeafe43af 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultSubcontent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultSubcontent.java @@ -19,9 +19,9 @@ */ package com.google.genai.gaos.models.interactions; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; -import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver; import java.lang.String; @@ -30,12 +30,9 @@ property = "type", include = As.EXISTING_PROPERTY, visible = true, - defaultImpl = UnknownFunctionResultSubcontent.class -) + defaultImpl = UnknownFunctionResultSubcontent.class) @JsonTypeIdResolver(FunctionResultSubcontentTypeIdResolver.class) public interface FunctionResultSubcontent { String type(); - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultSubcontentTypeIdResolver.java b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultSubcontentTypeIdResolver.java index f0dab32de87..6831080d8ab 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultSubcontentTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultSubcontentTypeIdResolver.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.google.genai.gaos.utils.GenericTypeIdResolver; @@ -26,7 +25,6 @@ import java.lang.Override; import java.lang.String; - public class FunctionResultSubcontentTypeIdResolver extends GenericTypeIdResolver { public FunctionResultSubcontentTypeIdResolver() { @@ -44,19 +42,19 @@ public String idFromValue(Object value) { if (value == null) { return null; } - + // Handle known types by checking if they implement the discriminator method if (value instanceof FunctionResultSubcontent) { FunctionResultSubcontent discriminated = (FunctionResultSubcontent) value; return discriminated.type(); } - - throw new IllegalArgumentException("Unknown value type: " + value.getClass().getName()); + + throw new IllegalArgumentException( + "Unknown value type: " + value.getClass().getName()); } @Override public String getDescForKnownTypeIds() { return "FunctionResultSubcontent type resolver"; } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GenerationConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/GenerationConfig.java index 131f4773e40..19f28d8c2b8 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GenerationConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GenerationConfig.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -34,13 +34,13 @@ /** * GenerationConfig - * + * *

Configuration parameters for model interactions. */ public class GenerationConfig { /** * The configuration for image interaction. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -62,13 +62,6 @@ public class GenerationConfig { @JsonProperty("seed") private Integer seed; - /** - * Configuration for speech interaction. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("speech_config") - private List speechConfig; - /** * A list of character sequences that will stop output interaction. */ @@ -76,12 +69,10 @@ public class GenerationConfig { @JsonProperty("stop_sequences") private List stopSequences; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("thinking_level") private ThinkingLevel thinkingLevel; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("thinking_summaries") private ThinkingSummaries thinkingSummaries; @@ -107,40 +98,44 @@ public class GenerationConfig { @JsonProperty("video_config") private VideoConfig videoConfig; + /** + * Optional. Speech and multi-speaker configuration. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("speech_config") + private SpeechConfigUnion speechConfig; + @JsonCreator public GenerationConfig( @JsonProperty("image_config") @Nullable ImageConfig imageConfig, @JsonProperty("max_output_tokens") @Nullable Integer maxOutputTokens, @JsonProperty("seed") @Nullable Integer seed, - @JsonProperty("speech_config") @Nullable List speechConfig, @JsonProperty("stop_sequences") @Nullable List stopSequences, @JsonProperty("thinking_level") @Nullable ThinkingLevel thinkingLevel, @JsonProperty("thinking_summaries") @Nullable ThinkingSummaries thinkingSummaries, @JsonProperty("tool_choice") @Nullable ToolChoice toolChoice, @JsonProperty("transcription_config") @Nullable TranscriptionConfig transcriptionConfig, - @JsonProperty("video_config") @Nullable VideoConfig videoConfig) { + @JsonProperty("video_config") @Nullable VideoConfig videoConfig, + @JsonProperty("speech_config") @Nullable SpeechConfigUnion speechConfig) { this.imageConfig = imageConfig; this.maxOutputTokens = maxOutputTokens; this.seed = seed; - this.speechConfig = speechConfig; this.stopSequences = stopSequences; this.thinkingLevel = thinkingLevel; this.thinkingSummaries = thinkingSummaries; this.toolChoice = toolChoice; this.transcriptionConfig = transcriptionConfig; this.videoConfig = videoConfig; + this.speechConfig = speechConfig; } - + public GenerationConfig() { - this(null, null, null, - null, null, null, - null, null, null, - null); + this(null, null, null, null, null, null, null, null, null, null); } /** * The configuration for image interaction. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -162,13 +157,6 @@ public Optional seed() { return Optional.ofNullable(this.seed); } - /** - * Configuration for speech interaction. - */ - public Optional> speechConfig() { - return Optional.ofNullable(this.speechConfig); - } - /** * A list of character sequences that will stop output interaction. */ @@ -205,14 +193,20 @@ public Optional videoConfig() { return Optional.ofNullable(this.videoConfig); } + /** + * Optional. Speech and multi-speaker configuration. + */ + public Optional speechConfig() { + return Optional.ofNullable(this.speechConfig); + } + public static Builder builder() { return new Builder(); } - /** * The configuration for image interaction. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -221,7 +215,6 @@ public GenerationConfig withImageConfig(@Nullable ImageConfig imageConfig) { return this; } - /** * The maximum number of tokens to include in the response. */ @@ -230,7 +223,6 @@ public GenerationConfig withMaxOutputTokens(@Nullable Integer maxOutputTokens) { return this; } - /** * Seed used in decoding for reproducibility. */ @@ -239,16 +231,6 @@ public GenerationConfig withSeed(@Nullable Integer seed) { return this; } - - /** - * Configuration for speech interaction. - */ - public GenerationConfig withSpeechConfig(@Nullable List speechConfig) { - this.speechConfig = speechConfig; - return this; - } - - /** * A list of character sequences that will stop output interaction. */ @@ -257,19 +239,16 @@ public GenerationConfig withStopSequences(@Nullable List stopSequences) return this; } - public GenerationConfig withThinkingLevel(@Nullable ThinkingLevel thinkingLevel) { this.thinkingLevel = thinkingLevel; return this; } - public GenerationConfig withThinkingSummaries(@Nullable ThinkingSummaries thinkingSummaries) { this.thinkingSummaries = thinkingSummaries; return this; } - /** * The tool choice configuration. */ @@ -278,7 +257,6 @@ public GenerationConfig withToolChoice(@Nullable ToolChoice toolChoice) { return this; } - /** * Configuration for speech recognition (transcription). */ @@ -287,7 +265,6 @@ public GenerationConfig withTranscriptionConfig(@Nullable TranscriptionConfig tr return this; } - /** * Configuration options for video generation. */ @@ -296,6 +273,13 @@ public GenerationConfig withVideoConfig(@Nullable VideoConfig videoConfig) { return this; } + /** + * Optional. Speech and multi-speaker configuration. + */ + public GenerationConfig withSpeechConfig(@Nullable SpeechConfigUnion speechConfig) { + this.speechConfig = speechConfig; + return this; + } @Override public boolean equals(java.lang.Object o) { @@ -306,45 +290,61 @@ public boolean equals(java.lang.Object o) { return false; } GenerationConfig other = (GenerationConfig) o; - return - Utils.enhancedDeepEquals(this.imageConfig, other.imageConfig) && - Utils.enhancedDeepEquals(this.maxOutputTokens, other.maxOutputTokens) && - Utils.enhancedDeepEquals(this.seed, other.seed) && - Utils.enhancedDeepEquals(this.speechConfig, other.speechConfig) && - Utils.enhancedDeepEquals(this.stopSequences, other.stopSequences) && - Utils.enhancedDeepEquals(this.thinkingLevel, other.thinkingLevel) && - Utils.enhancedDeepEquals(this.thinkingSummaries, other.thinkingSummaries) && - Utils.enhancedDeepEquals(this.toolChoice, other.toolChoice) && - Utils.enhancedDeepEquals(this.transcriptionConfig, other.transcriptionConfig) && - Utils.enhancedDeepEquals(this.videoConfig, other.videoConfig); + return Utils.enhancedDeepEquals(this.imageConfig, other.imageConfig) + && Utils.enhancedDeepEquals(this.maxOutputTokens, other.maxOutputTokens) + && Utils.enhancedDeepEquals(this.seed, other.seed) + && Utils.enhancedDeepEquals(this.stopSequences, other.stopSequences) + && Utils.enhancedDeepEquals(this.thinkingLevel, other.thinkingLevel) + && Utils.enhancedDeepEquals(this.thinkingSummaries, other.thinkingSummaries) + && Utils.enhancedDeepEquals(this.toolChoice, other.toolChoice) + && Utils.enhancedDeepEquals(this.transcriptionConfig, other.transcriptionConfig) + && Utils.enhancedDeepEquals(this.videoConfig, other.videoConfig) + && Utils.enhancedDeepEquals(this.speechConfig, other.speechConfig); } - + @Override public int hashCode() { return Utils.enhancedHash( - imageConfig, maxOutputTokens, seed, - speechConfig, stopSequences, thinkingLevel, - thinkingSummaries, toolChoice, transcriptionConfig, - videoConfig); + imageConfig, + maxOutputTokens, + seed, + stopSequences, + thinkingLevel, + thinkingSummaries, + toolChoice, + transcriptionConfig, + videoConfig, + speechConfig); } - + @Override public String toString() { - return Utils.toString(GenerationConfig.class, - "imageConfig", imageConfig, - "maxOutputTokens", maxOutputTokens, - "seed", seed, - "speechConfig", speechConfig, - "stopSequences", stopSequences, - "thinkingLevel", thinkingLevel, - "thinkingSummaries", thinkingSummaries, - "toolChoice", toolChoice, - "transcriptionConfig", transcriptionConfig, - "videoConfig", videoConfig); + return Utils.toString( + GenerationConfig.class, + "imageConfig", + imageConfig, + "maxOutputTokens", + maxOutputTokens, + "seed", + seed, + "stopSequences", + stopSequences, + "thinkingLevel", + thinkingLevel, + "thinkingSummaries", + thinkingSummaries, + "toolChoice", + toolChoice, + "transcriptionConfig", + transcriptionConfig, + "videoConfig", + videoConfig, + "speechConfig", + speechConfig); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { @Deprecated private ImageConfig imageConfig; @@ -353,8 +353,6 @@ public final static class Builder { private Integer seed; - private List speechConfig; - private List stopSequences; private ThinkingLevel thinkingLevel; @@ -367,13 +365,15 @@ public final static class Builder { private VideoConfig videoConfig; + private SpeechConfigUnion speechConfig; + private Builder() { - // force use of static builder() method + // force use of static builder() method } /** * The configuration for image interaction. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -398,14 +398,6 @@ public Builder seed(@Nullable Integer seed) { return this; } - /** - * Configuration for speech interaction. - */ - public Builder speechConfig(@Nullable List speechConfig) { - this.speechConfig = speechConfig; - return this; - } - /** * A list of character sequences that will stop output interaction. */ @@ -448,13 +440,26 @@ public Builder videoConfig(@Nullable VideoConfig videoConfig) { return this; } + /** + * Optional. Speech and multi-speaker configuration. + */ + public Builder speechConfig(@Nullable SpeechConfigUnion speechConfig) { + this.speechConfig = speechConfig; + return this; + } + public GenerationConfig build() { return new GenerationConfig( - imageConfig, maxOutputTokens, seed, - speechConfig, stopSequences, thinkingLevel, - thinkingSummaries, toolChoice, transcriptionConfig, - videoConfig); + imageConfig, + maxOutputTokens, + seed, + stopSequences, + thinkingLevel, + thinkingSummaries, + toolChoice, + transcriptionConfig, + videoConfig, + speechConfig); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleMaps.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleMaps.java index d6e5f17cc5a..bdf860bb7d4 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleMaps.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleMaps.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -35,7 +35,7 @@ /** * GoogleMaps - * + * *

A tool that can be used by the model to call Google Maps. */ public class GoogleMaps implements Tool { @@ -61,7 +61,6 @@ public class GoogleMaps implements Tool { @JsonProperty("longitude") private Double longitude; - @JsonProperty("type") private String type; @@ -75,7 +74,7 @@ public GoogleMaps( this.longitude = longitude; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public GoogleMaps() { this(null, null, null); } @@ -111,7 +110,6 @@ public static Builder builder() { return new Builder(); } - /** * Whether to return a widget context token in the tool call result of the * response. @@ -121,7 +119,6 @@ public GoogleMaps withEnableWidget(@Nullable Boolean enableWidget) { return this; } - /** * The latitude of the user's location. */ @@ -130,7 +127,6 @@ public GoogleMaps withLatitude(@Nullable Double latitude) { return this; } - /** * The longitude of the user's location. */ @@ -139,7 +135,6 @@ public GoogleMaps withLongitude(@Nullable Double longitude) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -149,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } GoogleMaps other = (GoogleMaps) o; - return - Utils.enhancedDeepEquals(this.enableWidget, other.enableWidget) && - Utils.enhancedDeepEquals(this.latitude, other.latitude) && - Utils.enhancedDeepEquals(this.longitude, other.longitude) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.enableWidget, other.enableWidget) + && Utils.enhancedDeepEquals(this.latitude, other.latitude) + && Utils.enhancedDeepEquals(this.longitude, other.longitude) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - enableWidget, latitude, longitude, - type); + return Utils.enhancedHash(enableWidget, latitude, longitude, type); } - + @Override public String toString() { - return Utils.toString(GoogleMaps.class, - "enableWidget", enableWidget, - "latitude", latitude, - "longitude", longitude, - "type", type); + return Utils.toString( + GoogleMaps.class, + "enableWidget", + enableWidget, + "latitude", + latitude, + "longitude", + longitude, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Boolean enableWidget; @@ -182,7 +179,7 @@ public final static class Builder { private Double longitude; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -211,15 +208,10 @@ public Builder longitude(@Nullable Double longitude) { } public GoogleMaps build() { - return new GoogleMaps( - enableWidget, latitude, longitude); + return new GoogleMaps(enableWidget, latitude, longitude); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"google_maps\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"google_maps\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsCallArguments.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsCallArguments.java index a59d61ebb67..e9ccbb6875b 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsCallArguments.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsCallArguments.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * GoogleMapsCallArguments - * + * *

The arguments to pass to the Google Maps tool. */ public class GoogleMapsCallArguments { @@ -44,11 +44,10 @@ public class GoogleMapsCallArguments { private List queries; @JsonCreator - public GoogleMapsCallArguments( - @JsonProperty("queries") @Nullable List queries) { + public GoogleMapsCallArguments(@JsonProperty("queries") @Nullable List queries) { this.queries = queries; } - + public GoogleMapsCallArguments() { this(null); } @@ -64,7 +63,6 @@ public static Builder builder() { return new Builder(); } - /** * The queries to be executed. */ @@ -73,7 +71,6 @@ public GoogleMapsCallArguments withQueries(@Nullable List queries) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -83,29 +80,26 @@ public boolean equals(java.lang.Object o) { return false; } GoogleMapsCallArguments other = (GoogleMapsCallArguments) o; - return - Utils.enhancedDeepEquals(this.queries, other.queries); + return Utils.enhancedDeepEquals(this.queries, other.queries); } - + @Override public int hashCode() { - return Utils.enhancedHash( - queries); + return Utils.enhancedHash(queries); } - + @Override public String toString() { - return Utils.toString(GoogleMapsCallArguments.class, - "queries", queries); + return Utils.toString(GoogleMapsCallArguments.class, "queries", queries); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List queries; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -117,9 +111,7 @@ public Builder queries(@Nullable List queries) { } public GoogleMapsCallArguments build() { - return new GoogleMapsCallArguments( - queries); + return new GoogleMapsCallArguments(queries); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsCallDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsCallDelta.java index 867a44c9da0..aa55e33c44a 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsCallDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsCallDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class GoogleMapsCallDelta implements StepDeltaData { /** * The arguments to pass to the Google Maps tool. @@ -47,7 +46,6 @@ public class GoogleMapsCallDelta implements StepDeltaData { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -59,7 +57,7 @@ public GoogleMapsCallDelta( this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public GoogleMapsCallDelta() { this(null, null); } @@ -87,7 +85,6 @@ public static Builder builder() { return new Builder(); } - /** * The arguments to pass to the Google Maps tool. */ @@ -96,7 +93,6 @@ public GoogleMapsCallDelta withArguments(@Nullable GoogleMapsCallArguments argum return this; } - /** * A signature hash for backend validation. */ @@ -105,7 +101,6 @@ public GoogleMapsCallDelta withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -115,35 +110,30 @@ public boolean equals(java.lang.Object o) { return false; } GoogleMapsCallDelta other = (GoogleMapsCallDelta) o; - return - Utils.enhancedDeepEquals(this.arguments, other.arguments) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.arguments, other.arguments) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - arguments, signature, type); + return Utils.enhancedHash(arguments, signature, type); } - + @Override public String toString() { - return Utils.toString(GoogleMapsCallDelta.class, - "arguments", arguments, - "signature", signature, - "type", type); + return Utils.toString(GoogleMapsCallDelta.class, "arguments", arguments, "signature", signature, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private GoogleMapsCallArguments arguments; private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -163,15 +153,10 @@ public Builder signature(@Nullable String signature) { } public GoogleMapsCallDelta build() { - return new GoogleMapsCallDelta( - arguments, signature); + return new GoogleMapsCallDelta(arguments, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"google_maps_call\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"google_maps_call\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsCallStep.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsCallStep.java index 29a4ed141b9..46ee0df6143 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsCallStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsCallStep.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * GoogleMapsCallStep - * + * *

Google Maps call step. */ public class GoogleMapsCallStep implements Step { @@ -58,7 +58,6 @@ public class GoogleMapsCallStep implements Step { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -68,14 +67,12 @@ public GoogleMapsCallStep( @JsonProperty("id") @Nonnull String id, @JsonProperty("signature") @Nullable String signature) { this.arguments = arguments; - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public GoogleMapsCallStep( - @Nonnull String id) { + + public GoogleMapsCallStep(@Nonnull String id) { this(null, id, null); } @@ -109,7 +106,6 @@ public static Builder builder() { return new Builder(); } - /** * The arguments to pass to the Google Maps tool. */ @@ -118,7 +114,6 @@ public GoogleMapsCallStep withArguments(@Nullable GoogleMapsCallArguments argume return this; } - /** * Required. A unique ID for this specific tool call. */ @@ -127,7 +122,6 @@ public GoogleMapsCallStep withId(@Nonnull String id) { return this; } - /** * A signature hash for backend validation. */ @@ -136,7 +130,6 @@ public GoogleMapsCallStep withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -146,31 +139,25 @@ public boolean equals(java.lang.Object o) { return false; } GoogleMapsCallStep other = (GoogleMapsCallStep) o; - return - Utils.enhancedDeepEquals(this.arguments, other.arguments) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.arguments, other.arguments) + && Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - arguments, id, signature, - type); + return Utils.enhancedHash(arguments, id, signature, type); } - + @Override public String toString() { - return Utils.toString(GoogleMapsCallStep.class, - "arguments", arguments, - "id", id, - "signature", signature, - "type", type); + return Utils.toString( + GoogleMapsCallStep.class, "arguments", arguments, "id", id, "signature", signature, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private GoogleMapsCallArguments arguments; @@ -179,7 +166,7 @@ public final static class Builder { private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -207,15 +194,10 @@ public Builder signature(@Nullable String signature) { } public GoogleMapsCallStep build() { - return new GoogleMapsCallStep( - arguments, id, signature); + return new GoogleMapsCallStep(arguments, id, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"google_maps_call\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"google_maps_call\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsResult.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsResult.java index 41b34834758..39ae8faee25 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsResult.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsResult.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * GoogleMapsResult - * + * *

The result of the Google Maps. */ public class GoogleMapsResult { @@ -41,7 +41,6 @@ public class GoogleMapsResult { @JsonProperty("places") private List places; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("widget_context_token") private String widgetContextToken; @@ -53,7 +52,7 @@ public GoogleMapsResult( this.places = places; this.widgetContextToken = widgetContextToken; } - + public GoogleMapsResult() { this(null, null); } @@ -70,19 +69,16 @@ public static Builder builder() { return new Builder(); } - public GoogleMapsResult withPlaces(@Nullable List places) { this.places = places; return this; } - public GoogleMapsResult withWidgetContextToken(@Nullable String widgetContextToken) { this.widgetContextToken = widgetContextToken; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -92,33 +88,29 @@ public boolean equals(java.lang.Object o) { return false; } GoogleMapsResult other = (GoogleMapsResult) o; - return - Utils.enhancedDeepEquals(this.places, other.places) && - Utils.enhancedDeepEquals(this.widgetContextToken, other.widgetContextToken); + return Utils.enhancedDeepEquals(this.places, other.places) + && Utils.enhancedDeepEquals(this.widgetContextToken, other.widgetContextToken); } - + @Override public int hashCode() { - return Utils.enhancedHash( - places, widgetContextToken); + return Utils.enhancedHash(places, widgetContextToken); } - + @Override public String toString() { - return Utils.toString(GoogleMapsResult.class, - "places", places, - "widgetContextToken", widgetContextToken); + return Utils.toString(GoogleMapsResult.class, "places", places, "widgetContextToken", widgetContextToken); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List places; private String widgetContextToken; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder places(@Nullable List places) { @@ -132,9 +124,7 @@ public Builder widgetContextToken(@Nullable String widgetContextToken) { } public GoogleMapsResult build() { - return new GoogleMapsResult( - places, widgetContextToken); + return new GoogleMapsResult(places, widgetContextToken); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsResultDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsResultDelta.java index ca9f5237b6e..08b84a64195 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsResultDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsResultDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -32,7 +32,6 @@ import java.util.List; import java.util.Optional; - public class GoogleMapsResultDelta implements StepDeltaData { /** * The results of the Google Maps. @@ -48,7 +47,6 @@ public class GoogleMapsResultDelta implements StepDeltaData { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -60,7 +58,7 @@ public GoogleMapsResultDelta( this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public GoogleMapsResultDelta() { this(null, null); } @@ -88,7 +86,6 @@ public static Builder builder() { return new Builder(); } - /** * The results of the Google Maps. */ @@ -97,7 +94,6 @@ public GoogleMapsResultDelta withResult(@Nullable List result) return this; } - /** * A signature hash for backend validation. */ @@ -106,7 +102,6 @@ public GoogleMapsResultDelta withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -116,35 +111,30 @@ public boolean equals(java.lang.Object o) { return false; } GoogleMapsResultDelta other = (GoogleMapsResultDelta) o; - return - Utils.enhancedDeepEquals(this.result, other.result) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.result, other.result) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - result, signature, type); + return Utils.enhancedHash(result, signature, type); } - + @Override public String toString() { - return Utils.toString(GoogleMapsResultDelta.class, - "result", result, - "signature", signature, - "type", type); + return Utils.toString(GoogleMapsResultDelta.class, "result", result, "signature", signature, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List result; private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -164,15 +154,10 @@ public Builder signature(@Nullable String signature) { } public GoogleMapsResultDelta build() { - return new GoogleMapsResultDelta( - result, signature); + return new GoogleMapsResultDelta(result, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"google_maps_result\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"google_maps_result\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsResultPlaces.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsResultPlaces.java index 152b43c70e4..f09c738de51 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsResultPlaces.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsResultPlaces.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -30,24 +30,20 @@ import java.util.List; import java.util.Optional; - public class GoogleMapsResultPlaces { @JsonInclude(Include.NON_ABSENT) @JsonProperty("name") private String name; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("place_id") private String placeId; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("review_snippets") private List reviewSnippets; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("url") private String url; @@ -63,10 +59,9 @@ public GoogleMapsResultPlaces( this.reviewSnippets = reviewSnippets; this.url = url; } - + public GoogleMapsResultPlaces() { - this(null, null, null, - null); + this(null, null, null, null); } public Optional name() { @@ -89,31 +84,26 @@ public static Builder builder() { return new Builder(); } - public GoogleMapsResultPlaces withName(@Nullable String name) { this.name = name; return this; } - public GoogleMapsResultPlaces withPlaceId(@Nullable String placeId) { this.placeId = placeId; return this; } - public GoogleMapsResultPlaces withReviewSnippets(@Nullable List reviewSnippets) { this.reviewSnippets = reviewSnippets; return this; } - public GoogleMapsResultPlaces withUrl(@Nullable String url) { this.url = url; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -123,31 +113,33 @@ public boolean equals(java.lang.Object o) { return false; } GoogleMapsResultPlaces other = (GoogleMapsResultPlaces) o; - return - Utils.enhancedDeepEquals(this.name, other.name) && - Utils.enhancedDeepEquals(this.placeId, other.placeId) && - Utils.enhancedDeepEquals(this.reviewSnippets, other.reviewSnippets) && - Utils.enhancedDeepEquals(this.url, other.url); + return Utils.enhancedDeepEquals(this.name, other.name) + && Utils.enhancedDeepEquals(this.placeId, other.placeId) + && Utils.enhancedDeepEquals(this.reviewSnippets, other.reviewSnippets) + && Utils.enhancedDeepEquals(this.url, other.url); } - + @Override public int hashCode() { - return Utils.enhancedHash( - name, placeId, reviewSnippets, - url); + return Utils.enhancedHash(name, placeId, reviewSnippets, url); } - + @Override public String toString() { - return Utils.toString(GoogleMapsResultPlaces.class, - "name", name, - "placeId", placeId, - "reviewSnippets", reviewSnippets, - "url", url); + return Utils.toString( + GoogleMapsResultPlaces.class, + "name", + name, + "placeId", + placeId, + "reviewSnippets", + reviewSnippets, + "url", + url); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String name; @@ -158,7 +150,7 @@ public final static class Builder { private String url; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder name(@Nullable String name) { @@ -182,10 +174,7 @@ public Builder url(@Nullable String url) { } public GoogleMapsResultPlaces build() { - return new GoogleMapsResultPlaces( - name, placeId, reviewSnippets, - url); + return new GoogleMapsResultPlaces(name, placeId, reviewSnippets, url); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsResultStep.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsResultStep.java index 3ec601f9c06..0c20408f74e 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsResultStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleMapsResultStep.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -35,7 +35,7 @@ /** * GoogleMapsResultStep - * + * *

Google Maps result step. */ public class GoogleMapsResultStep implements Step { @@ -45,7 +45,6 @@ public class GoogleMapsResultStep implements Step { @JsonProperty("call_id") private String callId; - @JsonProperty("result") private List result; @@ -56,7 +55,6 @@ public class GoogleMapsResultStep implements Step { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -65,17 +63,15 @@ public GoogleMapsResultStep( @JsonProperty("call_id") @Nonnull String callId, @JsonProperty("result") @Nonnull List result, @JsonProperty("signature") @Nullable String signature) { - this.callId = Optional.ofNullable(callId) - .orElseThrow(() -> new IllegalArgumentException("callId cannot be null")); - this.result = Optional.ofNullable(result) - .orElseThrow(() -> new IllegalArgumentException("result cannot be null")); + this.callId = + Optional.ofNullable(callId).orElseThrow(() -> new IllegalArgumentException("callId cannot be null")); + this.result = + Optional.ofNullable(result).orElseThrow(() -> new IllegalArgumentException("result cannot be null")); this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public GoogleMapsResultStep( - @Nonnull String callId, - @Nonnull List result) { + + public GoogleMapsResultStep(@Nonnull String callId, @Nonnull List result) { this(callId, result, null); } @@ -106,7 +102,6 @@ public static Builder builder() { return new Builder(); } - /** * Required. ID to match the ID from the function call block. */ @@ -115,13 +110,11 @@ public GoogleMapsResultStep withCallId(@Nonnull String callId) { return this; } - public GoogleMapsResultStep withResult(@Nonnull List result) { this.result = Utils.checkNotNull(result, "result"); return this; } - /** * A signature hash for backend validation. */ @@ -130,7 +123,6 @@ public GoogleMapsResultStep withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -140,31 +132,25 @@ public boolean equals(java.lang.Object o) { return false; } GoogleMapsResultStep other = (GoogleMapsResultStep) o; - return - Utils.enhancedDeepEquals(this.callId, other.callId) && - Utils.enhancedDeepEquals(this.result, other.result) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.callId, other.callId) + && Utils.enhancedDeepEquals(this.result, other.result) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - callId, result, signature, - type); + return Utils.enhancedHash(callId, result, signature, type); } - + @Override public String toString() { - return Utils.toString(GoogleMapsResultStep.class, - "callId", callId, - "result", result, - "signature", signature, - "type", type); + return Utils.toString( + GoogleMapsResultStep.class, "callId", callId, "result", result, "signature", signature, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String callId; @@ -173,7 +159,7 @@ public final static class Builder { private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -198,15 +184,10 @@ public Builder signature(@Nullable String signature) { } public GoogleMapsResultStep build() { - return new GoogleMapsResultStep( - callId, result, signature); + return new GoogleMapsResultStep(callId, result, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"google_maps_result\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"google_maps_result\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearch.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearch.java index b14de7a9aba..09c893a181f 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearch.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearch.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.models.agents.AgentTool; @@ -35,7 +35,7 @@ /** * GoogleSearch - * + * *

A tool that can be used by the model to search Google. */ public class GoogleSearch implements Tool, AgentTool { @@ -46,17 +46,15 @@ public class GoogleSearch implements Tool, AgentTool { @JsonProperty("search_types") private List searchTypes; - @JsonProperty("type") private String type; @JsonCreator - public GoogleSearch( - @JsonProperty("search_types") @Nullable List searchTypes) { + public GoogleSearch(@JsonProperty("search_types") @Nullable List searchTypes) { this.searchTypes = searchTypes; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public GoogleSearch() { this(null); } @@ -77,7 +75,6 @@ public static Builder builder() { return new Builder(); } - /** * The types of search grounding to enable. */ @@ -86,7 +83,6 @@ public GoogleSearch withSearchTypes(@Nullable List searc return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -96,31 +92,27 @@ public boolean equals(java.lang.Object o) { return false; } GoogleSearch other = (GoogleSearch) o; - return - Utils.enhancedDeepEquals(this.searchTypes, other.searchTypes) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.searchTypes, other.searchTypes) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - searchTypes, type); + return Utils.enhancedHash(searchTypes, type); } - + @Override public String toString() { - return Utils.toString(GoogleSearch.class, - "searchTypes", searchTypes, - "type", type); + return Utils.toString(GoogleSearch.class, "searchTypes", searchTypes, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List searchTypes; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -132,15 +124,10 @@ public Builder searchTypes(@Nullable List searchTypes) { } public GoogleSearch build() { - return new GoogleSearch( - searchTypes); + return new GoogleSearch(searchTypes); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"google_search\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"google_search\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchCallArguments.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchCallArguments.java index 4c4ec1f5e91..e09126fb454 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchCallArguments.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchCallArguments.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * GoogleSearchCallArguments - * + * *

The arguments to pass to Google Search. */ public class GoogleSearchCallArguments { @@ -44,11 +44,10 @@ public class GoogleSearchCallArguments { private List queries; @JsonCreator - public GoogleSearchCallArguments( - @JsonProperty("queries") @Nullable List queries) { + public GoogleSearchCallArguments(@JsonProperty("queries") @Nullable List queries) { this.queries = queries; } - + public GoogleSearchCallArguments() { this(null); } @@ -64,7 +63,6 @@ public static Builder builder() { return new Builder(); } - /** * Web search queries for the following-up web search. */ @@ -73,7 +71,6 @@ public GoogleSearchCallArguments withQueries(@Nullable List queries) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -83,29 +80,26 @@ public boolean equals(java.lang.Object o) { return false; } GoogleSearchCallArguments other = (GoogleSearchCallArguments) o; - return - Utils.enhancedDeepEquals(this.queries, other.queries); + return Utils.enhancedDeepEquals(this.queries, other.queries); } - + @Override public int hashCode() { - return Utils.enhancedHash( - queries); + return Utils.enhancedHash(queries); } - + @Override public String toString() { - return Utils.toString(GoogleSearchCallArguments.class, - "queries", queries); + return Utils.toString(GoogleSearchCallArguments.class, "queries", queries); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List queries; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -117,9 +111,7 @@ public Builder queries(@Nullable List queries) { } public GoogleSearchCallArguments build() { - return new GoogleSearchCallArguments( - queries); + return new GoogleSearchCallArguments(queries); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchCallDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchCallDelta.java index 20ce913c8d2..c774df61f54 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchCallDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchCallDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -32,7 +32,6 @@ import java.lang.String; import java.util.Optional; - public class GoogleSearchCallDelta implements StepDeltaData { /** * The arguments to pass to Google Search. @@ -47,7 +46,6 @@ public class GoogleSearchCallDelta implements StepDeltaData { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -56,13 +54,12 @@ public GoogleSearchCallDelta( @JsonProperty("arguments") @Nonnull GoogleSearchCallArguments arguments, @JsonProperty("signature") @Nullable String signature) { this.arguments = Optional.ofNullable(arguments) - .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public GoogleSearchCallDelta( - @Nonnull GoogleSearchCallArguments arguments) { + + public GoogleSearchCallDelta(@Nonnull GoogleSearchCallArguments arguments) { this(arguments, null); } @@ -89,7 +86,6 @@ public static Builder builder() { return new Builder(); } - /** * The arguments to pass to Google Search. */ @@ -98,7 +94,6 @@ public GoogleSearchCallDelta withArguments(@Nonnull GoogleSearchCallArguments ar return this; } - /** * A signature hash for backend validation. */ @@ -107,7 +102,6 @@ public GoogleSearchCallDelta withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -117,35 +111,31 @@ public boolean equals(java.lang.Object o) { return false; } GoogleSearchCallDelta other = (GoogleSearchCallDelta) o; - return - Utils.enhancedDeepEquals(this.arguments, other.arguments) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.arguments, other.arguments) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - arguments, signature, type); + return Utils.enhancedHash(arguments, signature, type); } - + @Override public String toString() { - return Utils.toString(GoogleSearchCallDelta.class, - "arguments", arguments, - "signature", signature, - "type", type); + return Utils.toString( + GoogleSearchCallDelta.class, "arguments", arguments, "signature", signature, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private GoogleSearchCallArguments arguments; private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -165,15 +155,10 @@ public Builder signature(@Nullable String signature) { } public GoogleSearchCallDelta build() { - return new GoogleSearchCallDelta( - arguments, signature); + return new GoogleSearchCallDelta(arguments, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"google_search_call\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"google_search_call\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchCallStep.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchCallStep.java index d37182c899c..67eff9e2522 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchCallStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchCallStep.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * GoogleSearchCallStep - * + * *

Google Search call step. */ public class GoogleSearchCallStep implements Step { @@ -64,7 +64,6 @@ public class GoogleSearchCallStep implements Step { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -75,19 +74,15 @@ public GoogleSearchCallStep( @JsonProperty("search_type") @Nullable GoogleSearchCallStepSearchType searchType, @JsonProperty("signature") @Nullable String signature) { this.arguments = Optional.ofNullable(arguments) - .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); this.searchType = searchType; this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public GoogleSearchCallStep( - @Nonnull GoogleSearchCallArguments arguments, - @Nonnull String id) { - this(arguments, id, null, - null); + + public GoogleSearchCallStep(@Nonnull GoogleSearchCallArguments arguments, @Nonnull String id) { + this(arguments, id, null, null); } /** @@ -127,7 +122,6 @@ public static Builder builder() { return new Builder(); } - /** * The arguments to pass to Google Search. */ @@ -136,7 +130,6 @@ public GoogleSearchCallStep withArguments(@Nonnull GoogleSearchCallArguments arg return this; } - /** * Required. A unique ID for this specific tool call. */ @@ -145,7 +138,6 @@ public GoogleSearchCallStep withId(@Nonnull String id) { return this; } - /** * The type of search grounding enabled. */ @@ -154,7 +146,6 @@ public GoogleSearchCallStep withSearchType(@Nullable GoogleSearchCallStepSearchT return this; } - /** * A signature hash for backend validation. */ @@ -163,7 +154,6 @@ public GoogleSearchCallStep withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -173,33 +163,36 @@ public boolean equals(java.lang.Object o) { return false; } GoogleSearchCallStep other = (GoogleSearchCallStep) o; - return - Utils.enhancedDeepEquals(this.arguments, other.arguments) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.searchType, other.searchType) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.arguments, other.arguments) + && Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.searchType, other.searchType) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - arguments, id, searchType, - signature, type); + return Utils.enhancedHash(arguments, id, searchType, signature, type); } - + @Override public String toString() { - return Utils.toString(GoogleSearchCallStep.class, - "arguments", arguments, - "id", id, - "searchType", searchType, - "signature", signature, - "type", type); + return Utils.toString( + GoogleSearchCallStep.class, + "arguments", + arguments, + "id", + id, + "searchType", + searchType, + "signature", + signature, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private GoogleSearchCallArguments arguments; @@ -210,7 +203,7 @@ public final static class Builder { private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -246,16 +239,10 @@ public Builder signature(@Nullable String signature) { } public GoogleSearchCallStep build() { - return new GoogleSearchCallStep( - arguments, id, searchType, - signature); + return new GoogleSearchCallStep(arguments, id, searchType, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"google_search_call\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"google_search_call\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchCallStepSearchType.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchCallStepSearchType.java index 3932ead4549..2cf7251e78c 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchCallStepSearchType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchCallStepSearchType.java @@ -36,14 +36,16 @@ */ /** * GoogleSearchCallStepSearchType - * + * *

The type of search grounding enabled. */ public class GoogleSearchCallStepSearchType { public static final GoogleSearchCallStepSearchType WEB_SEARCH = new GoogleSearchCallStepSearchType("web_search"); - public static final GoogleSearchCallStepSearchType IMAGE_SEARCH = new GoogleSearchCallStepSearchType("image_search"); - public static final GoogleSearchCallStepSearchType ENTERPRISE_WEB_SEARCH = new GoogleSearchCallStepSearchType("enterprise_web_search"); + public static final GoogleSearchCallStepSearchType IMAGE_SEARCH = + new GoogleSearchCallStepSearchType("image_search"); + public static final GoogleSearchCallStepSearchType ENTERPRISE_WEB_SEARCH = + new GoogleSearchCallStepSearchType("enterprise_web_search"); // This map will grow whenever a Color gets created with a new // unrecognized value (a potential memory leak if the user is not @@ -60,12 +62,12 @@ private GoogleSearchCallStepSearchType(String value) { } /** - * Returns a GoogleSearchCallStepSearchType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a GoogleSearchCallStepSearchType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as GoogleSearchCallStepSearchType - */ + */ @JsonCreator public static GoogleSearchCallStepSearchType of(String value) { synchronized (GoogleSearchCallStepSearchType.class) { @@ -93,12 +95,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; GoogleSearchCallStepSearchType other = (GoogleSearchCallStepSearchType) obj; return Objects.equals(value, other.value); } @@ -130,13 +129,13 @@ private static final Map createEnums map.put("enterprise_web_search", GoogleSearchCallStepSearchTypeEnum.ENTERPRISE_WEB_SEARCH); return map; } - - + public enum GoogleSearchCallStepSearchTypeEnum { WEB_SEARCH("web_search"), IMAGE_SEARCH("image_search"), - ENTERPRISE_WEB_SEARCH("enterprise_web_search"),; + ENTERPRISE_WEB_SEARCH("enterprise_web_search"), + ; private final String value; @@ -149,4 +148,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchResult.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchResult.java index 1708f882ca7..c8c5d73afcd 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchResult.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchResult.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -31,7 +31,7 @@ /** * GoogleSearchResult - * + * *

The result of the Google Search. */ public class GoogleSearchResult { @@ -43,11 +43,10 @@ public class GoogleSearchResult { private String searchSuggestions; @JsonCreator - public GoogleSearchResult( - @JsonProperty("search_suggestions") @Nullable String searchSuggestions) { + public GoogleSearchResult(@JsonProperty("search_suggestions") @Nullable String searchSuggestions) { this.searchSuggestions = searchSuggestions; } - + public GoogleSearchResult() { this(null); } @@ -63,7 +62,6 @@ public static Builder builder() { return new Builder(); } - /** * Web content snippet that can be embedded in a web page or an app webview. */ @@ -72,7 +70,6 @@ public GoogleSearchResult withSearchSuggestions(@Nullable String searchSuggestio return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -82,29 +79,26 @@ public boolean equals(java.lang.Object o) { return false; } GoogleSearchResult other = (GoogleSearchResult) o; - return - Utils.enhancedDeepEquals(this.searchSuggestions, other.searchSuggestions); + return Utils.enhancedDeepEquals(this.searchSuggestions, other.searchSuggestions); } - + @Override public int hashCode() { - return Utils.enhancedHash( - searchSuggestions); + return Utils.enhancedHash(searchSuggestions); } - + @Override public String toString() { - return Utils.toString(GoogleSearchResult.class, - "searchSuggestions", searchSuggestions); + return Utils.toString(GoogleSearchResult.class, "searchSuggestions", searchSuggestions); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String searchSuggestions; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -116,9 +110,7 @@ public Builder searchSuggestions(@Nullable String searchSuggestions) { } public GoogleSearchResult build() { - return new GoogleSearchResult( - searchSuggestions); + return new GoogleSearchResult(searchSuggestions); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchResultDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchResultDelta.java index 071e6e4e215..d86075cfc5a 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchResultDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchResultDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,14 +34,12 @@ import java.util.List; import java.util.Optional; - public class GoogleSearchResultDelta implements StepDeltaData { @JsonInclude(Include.NON_ABSENT) @JsonProperty("is_error") private Boolean isError; - @JsonProperty("result") private List result; @@ -52,7 +50,6 @@ public class GoogleSearchResultDelta implements StepDeltaData { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -62,14 +59,13 @@ public GoogleSearchResultDelta( @JsonProperty("result") @Nonnull List result, @JsonProperty("signature") @Nullable String signature) { this.isError = isError; - this.result = Optional.ofNullable(result) - .orElseThrow(() -> new IllegalArgumentException("result cannot be null")); + this.result = + Optional.ofNullable(result).orElseThrow(() -> new IllegalArgumentException("result cannot be null")); this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public GoogleSearchResultDelta( - @Nonnull List result) { + + public GoogleSearchResultDelta(@Nonnull List result) { this(null, result, null); } @@ -97,19 +93,16 @@ public static Builder builder() { return new Builder(); } - public GoogleSearchResultDelta withIsError(@Nullable Boolean isError) { this.isError = isError; return this; } - public GoogleSearchResultDelta withResult(@Nonnull List result) { this.result = Utils.checkNotNull(result, "result"); return this; } - /** * A signature hash for backend validation. */ @@ -118,7 +111,6 @@ public GoogleSearchResultDelta withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -128,31 +120,33 @@ public boolean equals(java.lang.Object o) { return false; } GoogleSearchResultDelta other = (GoogleSearchResultDelta) o; - return - Utils.enhancedDeepEquals(this.isError, other.isError) && - Utils.enhancedDeepEquals(this.result, other.result) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.isError, other.isError) + && Utils.enhancedDeepEquals(this.result, other.result) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - isError, result, signature, - type); + return Utils.enhancedHash(isError, result, signature, type); } - + @Override public String toString() { - return Utils.toString(GoogleSearchResultDelta.class, - "isError", isError, - "result", result, - "signature", signature, - "type", type); + return Utils.toString( + GoogleSearchResultDelta.class, + "isError", + isError, + "result", + result, + "signature", + signature, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Boolean isError; @@ -161,7 +155,7 @@ public final static class Builder { private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder isError(@Nullable Boolean isError) { @@ -183,15 +177,10 @@ public Builder signature(@Nullable String signature) { } public GoogleSearchResultDelta build() { - return new GoogleSearchResultDelta( - isError, result, signature); + return new GoogleSearchResultDelta(isError, result, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"google_search_result\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"google_search_result\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchResultStep.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchResultStep.java index da98746485b..d4689ed1164 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchResultStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchResultStep.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -36,7 +36,7 @@ /** * GoogleSearchResultStep - * + * *

Google Search result step. */ public class GoogleSearchResultStep implements Step { @@ -66,7 +66,6 @@ public class GoogleSearchResultStep implements Step { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -76,20 +75,17 @@ public GoogleSearchResultStep( @JsonProperty("is_error") @Nullable Boolean isError, @JsonProperty("result") @Nonnull List result, @JsonProperty("signature") @Nullable String signature) { - this.callId = Optional.ofNullable(callId) - .orElseThrow(() -> new IllegalArgumentException("callId cannot be null")); + this.callId = + Optional.ofNullable(callId).orElseThrow(() -> new IllegalArgumentException("callId cannot be null")); this.isError = isError; - this.result = Optional.ofNullable(result) - .orElseThrow(() -> new IllegalArgumentException("result cannot be null")); + this.result = + Optional.ofNullable(result).orElseThrow(() -> new IllegalArgumentException("result cannot be null")); this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public GoogleSearchResultStep( - @Nonnull String callId, - @Nonnull List result) { - this(callId, null, result, - null); + + public GoogleSearchResultStep(@Nonnull String callId, @Nonnull List result) { + this(callId, null, result, null); } /** @@ -129,7 +125,6 @@ public static Builder builder() { return new Builder(); } - /** * Required. ID to match the ID from the function call block. */ @@ -138,7 +133,6 @@ public GoogleSearchResultStep withCallId(@Nonnull String callId) { return this; } - /** * Whether the Google Search resulted in an error. */ @@ -147,7 +141,6 @@ public GoogleSearchResultStep withIsError(@Nullable Boolean isError) { return this; } - /** * Required. The results of the Google Search. */ @@ -156,7 +149,6 @@ public GoogleSearchResultStep withResult(@Nonnull List resul return this; } - /** * A signature hash for backend validation. */ @@ -165,7 +157,6 @@ public GoogleSearchResultStep withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -175,33 +166,36 @@ public boolean equals(java.lang.Object o) { return false; } GoogleSearchResultStep other = (GoogleSearchResultStep) o; - return - Utils.enhancedDeepEquals(this.callId, other.callId) && - Utils.enhancedDeepEquals(this.isError, other.isError) && - Utils.enhancedDeepEquals(this.result, other.result) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.callId, other.callId) + && Utils.enhancedDeepEquals(this.isError, other.isError) + && Utils.enhancedDeepEquals(this.result, other.result) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - callId, isError, result, - signature, type); + return Utils.enhancedHash(callId, isError, result, signature, type); } - + @Override public String toString() { - return Utils.toString(GoogleSearchResultStep.class, - "callId", callId, - "isError", isError, - "result", result, - "signature", signature, - "type", type); + return Utils.toString( + GoogleSearchResultStep.class, + "callId", + callId, + "isError", + isError, + "result", + result, + "signature", + signature, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String callId; @@ -212,7 +206,7 @@ public final static class Builder { private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -248,16 +242,10 @@ public Builder signature(@Nullable String signature) { } public GoogleSearchResultStep build() { - return new GoogleSearchResultStep( - callId, isError, result, - signature); + return new GoogleSearchResultStep(callId, isError, result, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"google_search_result\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"google_search_result\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchSearchType.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchSearchType.java index 7937f3bbf9f..654d57fc4a1 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchSearchType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearchSearchType.java @@ -38,7 +38,8 @@ public class GoogleSearchSearchType { public static final GoogleSearchSearchType WEB_SEARCH = new GoogleSearchSearchType("web_search"); public static final GoogleSearchSearchType IMAGE_SEARCH = new GoogleSearchSearchType("image_search"); - public static final GoogleSearchSearchType ENTERPRISE_WEB_SEARCH = new GoogleSearchSearchType("enterprise_web_search"); + public static final GoogleSearchSearchType ENTERPRISE_WEB_SEARCH = + new GoogleSearchSearchType("enterprise_web_search"); // This map will grow whenever a Color gets created with a new // unrecognized value (a potential memory leak if the user is not @@ -55,12 +56,12 @@ private GoogleSearchSearchType(String value) { } /** - * Returns a GoogleSearchSearchType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a GoogleSearchSearchType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as GoogleSearchSearchType - */ + */ @JsonCreator public static GoogleSearchSearchType of(String value) { synchronized (GoogleSearchSearchType.class) { @@ -88,12 +89,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; GoogleSearchSearchType other = (GoogleSearchSearchType) obj; return Objects.equals(value, other.value); } @@ -125,13 +123,13 @@ private static final Map createEnumsMap() { map.put("enterprise_web_search", GoogleSearchSearchTypeEnum.ENTERPRISE_WEB_SEARCH); return map; } - - + public enum GoogleSearchSearchTypeEnum { WEB_SEARCH("web_search"), IMAGE_SEARCH("image_search"), - ENTERPRISE_WEB_SEARCH("enterprise_web_search"),; + ENTERPRISE_WEB_SEARCH("enterprise_web_search"), + ; private final String value; @@ -144,4 +142,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GroundingToolCount.java b/src/main/java/com/google/genai/gaos/models/interactions/GroundingToolCount.java index a1eaca02938..dc5ad480f31 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GroundingToolCount.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GroundingToolCount.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * GroundingToolCount - * + * *

The number of grounding tool counts. */ public class GroundingToolCount { @@ -57,7 +57,7 @@ public GroundingToolCount( this.count = count; this.type = type; } - + public GroundingToolCount() { this(null, null); } @@ -80,7 +80,6 @@ public static Builder builder() { return new Builder(); } - /** * The number of grounding tool counts. */ @@ -89,7 +88,6 @@ public GroundingToolCount withCount(@Nullable Integer count) { return this; } - /** * The grounding tool type associated with the count. */ @@ -98,7 +96,6 @@ public GroundingToolCount withType(@Nullable GroundingToolCountType type) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -108,33 +105,28 @@ public boolean equals(java.lang.Object o) { return false; } GroundingToolCount other = (GroundingToolCount) o; - return - Utils.enhancedDeepEquals(this.count, other.count) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.count, other.count) && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - count, type); + return Utils.enhancedHash(count, type); } - + @Override public String toString() { - return Utils.toString(GroundingToolCount.class, - "count", count, - "type", type); + return Utils.toString(GroundingToolCount.class, "count", count, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Integer count; private GroundingToolCountType type; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -154,9 +146,7 @@ public Builder type(@Nullable GroundingToolCountType type) { } public GroundingToolCount build() { - return new GroundingToolCount( - count, type); + return new GroundingToolCount(count, type); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GroundingToolCountType.java b/src/main/java/com/google/genai/gaos/models/interactions/GroundingToolCountType.java index 6d75d8be442..28184ad40dc 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GroundingToolCountType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GroundingToolCountType.java @@ -36,7 +36,7 @@ */ /** * GroundingToolCountType - * + * *

The grounding tool type associated with the count. */ public class GroundingToolCountType { @@ -60,12 +60,12 @@ private GroundingToolCountType(String value) { } /** - * Returns a GroundingToolCountType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a GroundingToolCountType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as GroundingToolCountType - */ + */ @JsonCreator public static GroundingToolCountType of(String value) { synchronized (GroundingToolCountType.class) { @@ -93,12 +93,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; GroundingToolCountType other = (GroundingToolCountType) obj; return Objects.equals(value, other.value); } @@ -130,13 +127,13 @@ private static final Map createEnumsMap() { map.put("retrieval", GroundingToolCountTypeEnum.RETRIEVAL); return map; } - - + public enum GroundingToolCountTypeEnum { GOOGLE_SEARCH("google_search"), GOOGLE_MAPS("google_maps"), - RETRIEVAL("retrieval"),; + RETRIEVAL("retrieval"), + ; private final String value; @@ -149,4 +146,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/HarmCategory.java b/src/main/java/com/google/genai/gaos/models/interactions/HarmCategory.java index b1aa5c1cbec..7852d5bb1bd 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/HarmCategory.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/HarmCategory.java @@ -62,12 +62,12 @@ private HarmCategory(String value) { } /** - * Returns a HarmCategory with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a HarmCategory with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as HarmCategory - */ + */ @JsonCreator public static HarmCategory of(String value) { synchronized (HarmCategory.class) { @@ -95,12 +95,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; HarmCategory other = (HarmCategory) obj; return Objects.equals(value, other.value); } @@ -146,8 +143,7 @@ private static final Map createEnumsMap() { map.put("jailbreak", HarmCategoryEnum.JAILBREAK); return map; } - - + public enum HarmCategoryEnum { HATE_SPEECH("hate_speech"), @@ -159,7 +155,8 @@ public enum HarmCategoryEnum { IMAGE_DANGEROUS_CONTENT("image_dangerous_content"), IMAGE_HARASSMENT("image_harassment"), IMAGE_SEXUALLY_EXPLICIT("image_sexually_explicit"), - JAILBREAK("jailbreak"),; + JAILBREAK("jailbreak"), + ; private final String value; @@ -172,4 +169,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/HybridSearch.java b/src/main/java/com/google/genai/gaos/models/interactions/HybridSearch.java index 8343df0b2a1..029d8ff9cde 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/HybridSearch.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/HybridSearch.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * HybridSearch - * + * *

Config for Hybrid Search. */ public class HybridSearch { @@ -45,11 +45,10 @@ public class HybridSearch { private Float alpha; @JsonCreator - public HybridSearch( - @JsonProperty("alpha") @Nullable Float alpha) { + public HybridSearch(@JsonProperty("alpha") @Nullable Float alpha) { this.alpha = alpha; } - + public HybridSearch() { this(null); } @@ -66,7 +65,6 @@ public static Builder builder() { return new Builder(); } - /** * Optional. Alpha value controls the weight between dense and sparse vector search * results. @@ -76,7 +74,6 @@ public HybridSearch withAlpha(@Nullable Float alpha) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -86,29 +83,26 @@ public boolean equals(java.lang.Object o) { return false; } HybridSearch other = (HybridSearch) o; - return - Utils.enhancedDeepEquals(this.alpha, other.alpha); + return Utils.enhancedDeepEquals(this.alpha, other.alpha); } - + @Override public int hashCode() { - return Utils.enhancedHash( - alpha); + return Utils.enhancedHash(alpha); } - + @Override public String toString() { - return Utils.toString(HybridSearch.class, - "alpha", alpha); + return Utils.toString(HybridSearch.class, "alpha", alpha); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Float alpha; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -121,9 +115,7 @@ public Builder alpha(@Nullable Float alpha) { } public HybridSearch build() { - return new HybridSearch( - alpha); + return new HybridSearch(alpha); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ImageConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/ImageConfig.java index a2d42f513f5..b1bdee484f3 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ImageConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ImageConfig.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,9 +32,9 @@ /** * ImageConfig - * + * *

The configuration for image interaction. - * + * * @deprecated class: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -44,7 +44,6 @@ public class ImageConfig { @JsonProperty("aspect_ratio") private ImageConfigAspectRatio aspectRatio; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("image_size") private ImageConfigImageSize imageSize; @@ -56,7 +55,7 @@ public ImageConfig( this.aspectRatio = aspectRatio; this.imageSize = imageSize; } - + public ImageConfig() { this(null, null); } @@ -73,19 +72,16 @@ public static Builder builder() { return new Builder(); } - public ImageConfig withAspectRatio(@Nullable ImageConfigAspectRatio aspectRatio) { this.aspectRatio = aspectRatio; return this; } - public ImageConfig withImageSize(@Nullable ImageConfigImageSize imageSize) { this.imageSize = imageSize; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -95,33 +91,29 @@ public boolean equals(java.lang.Object o) { return false; } ImageConfig other = (ImageConfig) o; - return - Utils.enhancedDeepEquals(this.aspectRatio, other.aspectRatio) && - Utils.enhancedDeepEquals(this.imageSize, other.imageSize); + return Utils.enhancedDeepEquals(this.aspectRatio, other.aspectRatio) + && Utils.enhancedDeepEquals(this.imageSize, other.imageSize); } - + @Override public int hashCode() { - return Utils.enhancedHash( - aspectRatio, imageSize); + return Utils.enhancedHash(aspectRatio, imageSize); } - + @Override public String toString() { - return Utils.toString(ImageConfig.class, - "aspectRatio", aspectRatio, - "imageSize", imageSize); + return Utils.toString(ImageConfig.class, "aspectRatio", aspectRatio, "imageSize", imageSize); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private ImageConfigAspectRatio aspectRatio; private ImageConfigImageSize imageSize; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder aspectRatio(@Nullable ImageConfigAspectRatio aspectRatio) { @@ -135,9 +127,7 @@ public Builder imageSize(@Nullable ImageConfigImageSize imageSize) { } public ImageConfig build() { - return new ImageConfig( - aspectRatio, imageSize); + return new ImageConfig(aspectRatio, imageSize); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ImageConfigAspectRatio.java b/src/main/java/com/google/genai/gaos/models/interactions/ImageConfigAspectRatio.java index 68577399b1c..5d8e71e6a28 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ImageConfigAspectRatio.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ImageConfigAspectRatio.java @@ -66,12 +66,12 @@ private ImageConfigAspectRatio(String value) { } /** - * Returns a ImageConfigAspectRatio with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a ImageConfigAspectRatio with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as ImageConfigAspectRatio - */ + */ @JsonCreator public static ImageConfigAspectRatio of(String value) { synchronized (ImageConfigAspectRatio.class) { @@ -99,12 +99,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; ImageConfigAspectRatio other = (ImageConfigAspectRatio) obj; return Objects.equals(value, other.value); } @@ -158,8 +155,7 @@ private static final Map createEnumsMap() { map.put("4:1", ImageConfigAspectRatioEnum.FORTY_ONE); return map; } - - + public enum ImageConfigAspectRatioEnum { ELEVEN("1:1"), @@ -175,7 +171,8 @@ public enum ImageConfigAspectRatioEnum { EIGHTEEN("1:8"), EIGHTY_ONE("8:1"), FOURTEEN("1:4"), - FORTY_ONE("4:1"),; + FORTY_ONE("4:1"), + ; private final String value; @@ -188,4 +185,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ImageConfigImageSize.java b/src/main/java/com/google/genai/gaos/models/interactions/ImageConfigImageSize.java index db530eae961..0d1f6e68877 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ImageConfigImageSize.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ImageConfigImageSize.java @@ -56,12 +56,12 @@ private ImageConfigImageSize(String value) { } /** - * Returns a ImageConfigImageSize with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a ImageConfigImageSize with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as ImageConfigImageSize - */ + */ @JsonCreator public static ImageConfigImageSize of(String value) { synchronized (ImageConfigImageSize.class) { @@ -89,12 +89,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; ImageConfigImageSize other = (ImageConfigImageSize) obj; return Objects.equals(value, other.value); } @@ -128,14 +125,14 @@ private static final Map createEnumsMap() { map.put("512", ImageConfigImageSizeEnum.FIVE_HUNDRED_AND_TWELVE); return map; } - - + public enum ImageConfigImageSizeEnum { ONE_K("1K"), TWO_K("2K"), FOUR_K("4K"), - FIVE_HUNDRED_AND_TWELVE("512"),; + FIVE_HUNDRED_AND_TWELVE("512"), + ; private final String value; @@ -148,4 +145,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ImageContent.java b/src/main/java/com/google/genai/gaos/models/interactions/ImageContent.java index cdf85c1cd5e..f14ef00df96 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ImageContent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ImageContent.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -33,7 +33,7 @@ /** * ImageContent - * + * *

An image content block. */ public class ImageContent implements Content, ThoughtSummaryContent, FunctionResultSubcontent { @@ -44,12 +44,10 @@ public class ImageContent implements Content, ThoughtSummaryContent, FunctionRes @JsonProperty("data") private String data; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("resolution") private MediaResolution resolution; - @JsonProperty("type") private String type; @@ -79,10 +77,9 @@ public ImageContent( this.uri = uri; this.mimeType = mimeType; } - + public ImageContent() { - this(null, null, null, - null); + this(null, null, null, null); } /** @@ -119,7 +116,6 @@ public static Builder builder() { return new Builder(); } - /** * The image content. */ @@ -128,13 +124,11 @@ public ImageContent withData(@Nullable String data) { return this; } - public ImageContent withResolution(@Nullable MediaResolution resolution) { this.resolution = resolution; return this; } - /** * The URI of the image. */ @@ -143,7 +137,6 @@ public ImageContent withUri(@Nullable String uri) { return this; } - /** * The mime type of the image. */ @@ -152,7 +145,6 @@ public ImageContent withMimeType(@Nullable ImageContentMimeType mimeType) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -162,33 +154,36 @@ public boolean equals(java.lang.Object o) { return false; } ImageContent other = (ImageContent) o; - return - Utils.enhancedDeepEquals(this.data, other.data) && - Utils.enhancedDeepEquals(this.resolution, other.resolution) && - Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.uri, other.uri) && - Utils.enhancedDeepEquals(this.mimeType, other.mimeType); - } - + return Utils.enhancedDeepEquals(this.data, other.data) + && Utils.enhancedDeepEquals(this.resolution, other.resolution) + && Utils.enhancedDeepEquals(this.type, other.type) + && Utils.enhancedDeepEquals(this.uri, other.uri) + && Utils.enhancedDeepEquals(this.mimeType, other.mimeType); + } + @Override public int hashCode() { - return Utils.enhancedHash( - data, resolution, type, - uri, mimeType); + return Utils.enhancedHash(data, resolution, type, uri, mimeType); } - + @Override public String toString() { - return Utils.toString(ImageContent.class, - "data", data, - "resolution", resolution, - "type", type, - "uri", uri, - "mimeType", mimeType); + return Utils.toString( + ImageContent.class, + "data", + data, + "resolution", + resolution, + "type", + type, + "uri", + uri, + "mimeType", + mimeType); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String data; @@ -199,7 +194,7 @@ public final static class Builder { private ImageContentMimeType mimeType; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -232,16 +227,10 @@ public Builder mimeType(@Nullable ImageContentMimeType mimeType) { } public ImageContent build() { - return new ImageContent( - data, resolution, uri, - mimeType); + return new ImageContent(data, resolution, uri, mimeType); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"image\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"image\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ImageContentMimeType.java b/src/main/java/com/google/genai/gaos/models/interactions/ImageContentMimeType.java index 1f1dedb0fd8..fb5e32c0123 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ImageContentMimeType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ImageContentMimeType.java @@ -36,7 +36,7 @@ */ /** * ImageContentMimeType - * + * *

The mime type of the image. */ public class ImageContentMimeType { @@ -65,12 +65,12 @@ private ImageContentMimeType(String value) { } /** - * Returns a ImageContentMimeType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a ImageContentMimeType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as ImageContentMimeType - */ + */ @JsonCreator public static ImageContentMimeType of(String value) { synchronized (ImageContentMimeType.class) { @@ -98,12 +98,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; ImageContentMimeType other = (ImageContentMimeType) obj; return Objects.equals(value, other.value); } @@ -145,8 +142,7 @@ private static final Map createEnumsMap() { map.put("image/tiff", ImageContentMimeTypeEnum.IMAGE_TIFF); return map; } - - + public enum ImageContentMimeTypeEnum { IMAGE_PNG("image/png"), @@ -156,7 +152,8 @@ public enum ImageContentMimeTypeEnum { IMAGE_HEIF("image/heif"), IMAGE_GIF("image/gif"), IMAGE_BMP("image/bmp"), - IMAGE_TIFF("image/tiff"),; + IMAGE_TIFF("image/tiff"), + ; private final String value; @@ -169,4 +166,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ImageDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/ImageDelta.java index ef2f5630538..6cbb6376dfa 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ImageDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ImageDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -31,28 +31,23 @@ import java.lang.String; import java.util.Optional; - public class ImageDelta implements StepDeltaData { @JsonInclude(Include.NON_ABSENT) @JsonProperty("data") private String data; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("mime_type") private ImageDeltaMimeType mimeType; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("resolution") private MediaResolution resolution; - @JsonProperty("type") private String type; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("uri") private String uri; @@ -69,10 +64,9 @@ public ImageDelta( this.type = Builder._SINGLETON_VALUE_Type.value(); this.uri = uri; } - + public ImageDelta() { - this(null, null, null, - null); + this(null, null, null, null); } public Optional data() { @@ -100,31 +94,26 @@ public static Builder builder() { return new Builder(); } - public ImageDelta withData(@Nullable String data) { this.data = data; return this; } - public ImageDelta withMimeType(@Nullable ImageDeltaMimeType mimeType) { this.mimeType = mimeType; return this; } - public ImageDelta withResolution(@Nullable MediaResolution resolution) { this.resolution = resolution; return this; } - public ImageDelta withUri(@Nullable String uri) { this.uri = uri; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -134,33 +123,36 @@ public boolean equals(java.lang.Object o) { return false; } ImageDelta other = (ImageDelta) o; - return - Utils.enhancedDeepEquals(this.data, other.data) && - Utils.enhancedDeepEquals(this.mimeType, other.mimeType) && - Utils.enhancedDeepEquals(this.resolution, other.resolution) && - Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.uri, other.uri); - } - + return Utils.enhancedDeepEquals(this.data, other.data) + && Utils.enhancedDeepEquals(this.mimeType, other.mimeType) + && Utils.enhancedDeepEquals(this.resolution, other.resolution) + && Utils.enhancedDeepEquals(this.type, other.type) + && Utils.enhancedDeepEquals(this.uri, other.uri); + } + @Override public int hashCode() { - return Utils.enhancedHash( - data, mimeType, resolution, - type, uri); + return Utils.enhancedHash(data, mimeType, resolution, type, uri); } - + @Override public String toString() { - return Utils.toString(ImageDelta.class, - "data", data, - "mimeType", mimeType, - "resolution", resolution, - "type", type, - "uri", uri); + return Utils.toString( + ImageDelta.class, + "data", + data, + "mimeType", + mimeType, + "resolution", + resolution, + "type", + type, + "uri", + uri); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String data; @@ -171,7 +163,7 @@ public final static class Builder { private String uri; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder data(@Nullable String data) { @@ -195,16 +187,10 @@ public Builder uri(@Nullable String uri) { } public ImageDelta build() { - return new ImageDelta( - data, mimeType, resolution, - uri); + return new ImageDelta(data, mimeType, resolution, uri); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"image\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"image\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ImageDeltaMimeType.java b/src/main/java/com/google/genai/gaos/models/interactions/ImageDeltaMimeType.java index 7b7390a5a37..2dfeb45a5b7 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ImageDeltaMimeType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ImageDeltaMimeType.java @@ -60,12 +60,12 @@ private ImageDeltaMimeType(String value) { } /** - * Returns a ImageDeltaMimeType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a ImageDeltaMimeType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as ImageDeltaMimeType - */ + */ @JsonCreator public static ImageDeltaMimeType of(String value) { synchronized (ImageDeltaMimeType.class) { @@ -93,12 +93,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; ImageDeltaMimeType other = (ImageDeltaMimeType) obj; return Objects.equals(value, other.value); } @@ -140,8 +137,7 @@ private static final Map createEnumsMap() { map.put("image/tiff", ImageDeltaMimeTypeEnum.IMAGE_TIFF); return map; } - - + public enum ImageDeltaMimeTypeEnum { IMAGE_PNG("image/png"), @@ -151,7 +147,8 @@ public enum ImageDeltaMimeTypeEnum { IMAGE_HEIF("image/heif"), IMAGE_GIF("image/gif"), IMAGE_BMP("image/bmp"), - IMAGE_TIFF("image/tiff"),; + IMAGE_TIFF("image/tiff"), + ; private final String value; @@ -164,4 +161,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormat.java b/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormat.java index 9696a59de13..c5c64824c15 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormat.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormat.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -33,7 +33,7 @@ /** * ImageResponseFormat - * + * *

Configuration for image output format. */ public class ImageResponseFormat { @@ -65,7 +65,6 @@ public class ImageResponseFormat { @JsonProperty("mime_type") private ImageResponseFormatMimeType mimeType; - @JsonProperty("type") private String type; @@ -81,10 +80,9 @@ public ImageResponseFormat( this.mimeType = mimeType; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public ImageResponseFormat() { - this(null, null, null, - null); + this(null, null, null, null); } /** @@ -123,7 +121,6 @@ public static Builder builder() { return new Builder(); } - /** * The aspect ratio for the image output. */ @@ -132,7 +129,6 @@ public ImageResponseFormat withAspectRatio(@Nullable ImageResponseFormatAspectRa return this; } - /** * The delivery mode for the image output. */ @@ -141,7 +137,6 @@ public ImageResponseFormat withDelivery(@Nullable ImageResponseFormatDelivery de return this; } - /** * The size of the image output. */ @@ -150,7 +145,6 @@ public ImageResponseFormat withImageSize(@Nullable ImageResponseFormatImageSize return this; } - /** * The MIME type of the image output. */ @@ -159,7 +153,6 @@ public ImageResponseFormat withMimeType(@Nullable ImageResponseFormatMimeType mi return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -169,33 +162,36 @@ public boolean equals(java.lang.Object o) { return false; } ImageResponseFormat other = (ImageResponseFormat) o; - return - Utils.enhancedDeepEquals(this.aspectRatio, other.aspectRatio) && - Utils.enhancedDeepEquals(this.delivery, other.delivery) && - Utils.enhancedDeepEquals(this.imageSize, other.imageSize) && - Utils.enhancedDeepEquals(this.mimeType, other.mimeType) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.aspectRatio, other.aspectRatio) + && Utils.enhancedDeepEquals(this.delivery, other.delivery) + && Utils.enhancedDeepEquals(this.imageSize, other.imageSize) + && Utils.enhancedDeepEquals(this.mimeType, other.mimeType) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - aspectRatio, delivery, imageSize, - mimeType, type); + return Utils.enhancedHash(aspectRatio, delivery, imageSize, mimeType, type); } - + @Override public String toString() { - return Utils.toString(ImageResponseFormat.class, - "aspectRatio", aspectRatio, - "delivery", delivery, - "imageSize", imageSize, - "mimeType", mimeType, - "type", type); + return Utils.toString( + ImageResponseFormat.class, + "aspectRatio", + aspectRatio, + "delivery", + delivery, + "imageSize", + imageSize, + "mimeType", + mimeType, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private ImageResponseFormatAspectRatio aspectRatio; @@ -206,7 +202,7 @@ public final static class Builder { private ImageResponseFormatMimeType mimeType; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -242,16 +238,10 @@ public Builder mimeType(@Nullable ImageResponseFormatMimeType mimeType) { } public ImageResponseFormat build() { - return new ImageResponseFormat( - aspectRatio, delivery, imageSize, - mimeType); + return new ImageResponseFormat(aspectRatio, delivery, imageSize, mimeType); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"image\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"image\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormatAspectRatio.java b/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormatAspectRatio.java index eca4f345048..1d38628fa48 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormatAspectRatio.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormatAspectRatio.java @@ -36,7 +36,7 @@ */ /** * ImageResponseFormatAspectRatio - * + * *

The aspect ratio for the image output. */ public class ImageResponseFormatAspectRatio { @@ -48,9 +48,12 @@ public class ImageResponseFormatAspectRatio { public static final ImageResponseFormatAspectRatio FORTY_THREE = new ImageResponseFormatAspectRatio("4:3"); public static final ImageResponseFormatAspectRatio FORTY_FIVE = new ImageResponseFormatAspectRatio("4:5"); public static final ImageResponseFormatAspectRatio FIFTY_FOUR = new ImageResponseFormatAspectRatio("5:4"); - public static final ImageResponseFormatAspectRatio NINE_HUNDRED_AND_SIXTEEN = new ImageResponseFormatAspectRatio("9:16"); - public static final ImageResponseFormatAspectRatio ONE_HUNDRED_AND_SIXTY_NINE = new ImageResponseFormatAspectRatio("16:9"); - public static final ImageResponseFormatAspectRatio TWO_HUNDRED_AND_NINETEEN = new ImageResponseFormatAspectRatio("21:9"); + public static final ImageResponseFormatAspectRatio NINE_HUNDRED_AND_SIXTEEN = + new ImageResponseFormatAspectRatio("9:16"); + public static final ImageResponseFormatAspectRatio ONE_HUNDRED_AND_SIXTY_NINE = + new ImageResponseFormatAspectRatio("16:9"); + public static final ImageResponseFormatAspectRatio TWO_HUNDRED_AND_NINETEEN = + new ImageResponseFormatAspectRatio("21:9"); public static final ImageResponseFormatAspectRatio EIGHTEEN = new ImageResponseFormatAspectRatio("1:8"); public static final ImageResponseFormatAspectRatio EIGHTY_ONE = new ImageResponseFormatAspectRatio("8:1"); public static final ImageResponseFormatAspectRatio FOURTEEN = new ImageResponseFormatAspectRatio("1:4"); @@ -71,12 +74,12 @@ private ImageResponseFormatAspectRatio(String value) { } /** - * Returns a ImageResponseFormatAspectRatio with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a ImageResponseFormatAspectRatio with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as ImageResponseFormatAspectRatio - */ + */ @JsonCreator public static ImageResponseFormatAspectRatio of(String value) { synchronized (ImageResponseFormatAspectRatio.class) { @@ -104,12 +107,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; ImageResponseFormatAspectRatio other = (ImageResponseFormatAspectRatio) obj; return Objects.equals(value, other.value); } @@ -163,8 +163,7 @@ private static final Map createEnums map.put("4:1", ImageResponseFormatAspectRatioEnum.FORTY_ONE); return map; } - - + public enum ImageResponseFormatAspectRatioEnum { ELEVEN("1:1"), @@ -180,7 +179,8 @@ public enum ImageResponseFormatAspectRatioEnum { EIGHTEEN("1:8"), EIGHTY_ONE("8:1"), FOURTEEN("1:4"), - FORTY_ONE("4:1"),; + FORTY_ONE("4:1"), + ; private final String value; @@ -193,4 +193,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormatDelivery.java b/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormatDelivery.java index 480e21ff607..6c21a58ea21 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormatDelivery.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormatDelivery.java @@ -36,7 +36,7 @@ */ /** * ImageResponseFormatDelivery - * + * *

The delivery mode for the image output. */ public class ImageResponseFormatDelivery { @@ -59,12 +59,12 @@ private ImageResponseFormatDelivery(String value) { } /** - * Returns a ImageResponseFormatDelivery with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a ImageResponseFormatDelivery with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as ImageResponseFormatDelivery - */ + */ @JsonCreator public static ImageResponseFormatDelivery of(String value) { synchronized (ImageResponseFormatDelivery.class) { @@ -92,12 +92,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; ImageResponseFormatDelivery other = (ImageResponseFormatDelivery) obj; return Objects.equals(value, other.value); } @@ -127,12 +124,12 @@ private static final Map createEnumsMap map.put("uri", ImageResponseFormatDeliveryEnum.URI); return map; } - - + public enum ImageResponseFormatDeliveryEnum { INLINE("inline"), - URI("uri"),; + URI("uri"), + ; private final String value; @@ -145,4 +142,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormatImageSize.java b/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormatImageSize.java index 6ff558a5f39..a0d041ccbb1 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormatImageSize.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormatImageSize.java @@ -36,7 +36,7 @@ */ /** * ImageResponseFormatImageSize - * + * *

The size of the image output. */ public class ImageResponseFormatImageSize { @@ -61,12 +61,12 @@ private ImageResponseFormatImageSize(String value) { } /** - * Returns a ImageResponseFormatImageSize with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a ImageResponseFormatImageSize with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as ImageResponseFormatImageSize - */ + */ @JsonCreator public static ImageResponseFormatImageSize of(String value) { synchronized (ImageResponseFormatImageSize.class) { @@ -94,12 +94,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; ImageResponseFormatImageSize other = (ImageResponseFormatImageSize) obj; return Objects.equals(value, other.value); } @@ -133,14 +130,14 @@ private static final Map createEnumsMa map.put("4K", ImageResponseFormatImageSizeEnum.FOUR_K); return map; } - - + public enum ImageResponseFormatImageSizeEnum { FIVE_HUNDRED_AND_TWELVE("512"), ONE_K("1K"), TWO_K("2K"), - FOUR_K("4K"),; + FOUR_K("4K"), + ; private final String value; @@ -153,4 +150,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormatMimeType.java b/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormatMimeType.java index a1229e9206c..5ea5b896fca 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormatMimeType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ImageResponseFormatMimeType.java @@ -36,7 +36,7 @@ */ /** * ImageResponseFormatMimeType - * + * *

The MIME type of the image output. */ public class ImageResponseFormatMimeType { @@ -58,12 +58,12 @@ private ImageResponseFormatMimeType(String value) { } /** - * Returns a ImageResponseFormatMimeType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a ImageResponseFormatMimeType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as ImageResponseFormatMimeType - */ + */ @JsonCreator public static ImageResponseFormatMimeType of(String value) { synchronized (ImageResponseFormatMimeType.class) { @@ -91,12 +91,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; ImageResponseFormatMimeType other = (ImageResponseFormatMimeType) obj; return Objects.equals(value, other.value); } @@ -124,11 +121,11 @@ private static final Map createEnumsMap map.put("image/jpeg", ImageResponseFormatMimeTypeEnum.IMAGE_JPEG); return map; } - - + public enum ImageResponseFormatMimeTypeEnum { - IMAGE_JPEG("image/jpeg"),; + IMAGE_JPEG("image/jpeg"), + ; private final String value; @@ -141,4 +138,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Interaction.java b/src/main/java/com/google/genai/gaos/models/interactions/Interaction.java index cc6eeda22ab..135983d7c13 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Interaction.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Interaction.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -37,7 +37,7 @@ /** * Interaction - * + * *

The Interaction resource. */ public class Interaction { @@ -115,7 +115,7 @@ public class Interaction { /** * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -125,7 +125,7 @@ public class Interaction { /** * The mime type of the response. This is required if response_format is set. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -148,7 +148,6 @@ public class Interaction { @JsonProperty("environment_id") private String environmentId; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("service_tier") private ServiceTier serviceTier; @@ -220,7 +219,7 @@ public class Interaction { /** * Concatenated text from the last model output in response to the current request. - * + * *

Note: this is added by the SDK. */ @JsonInclude(Include.NON_ABSENT) @@ -280,10 +279,9 @@ public Interaction( @JsonProperty("output_video") @Nullable VideoContent outputVideo) { this.model = model; this.agent = agent; - this.id = Optional.ofNullable(id) - .orElse(Builder._SINGLETON_VALUE_Id.value()); - this.status = Optional.ofNullable(status) - .orElseThrow(() -> new IllegalArgumentException("status cannot be null")); + this.id = Optional.ofNullable(id).orElse(Builder._SINGLETON_VALUE_Id.value()); + this.status = + Optional.ofNullable(status).orElseThrow(() -> new IllegalArgumentException("status cannot be null")); this.created = created; this.updated = updated; this.systemInstruction = systemInstruction; @@ -309,19 +307,37 @@ public Interaction( this.outputAudio = outputAudio; this.outputVideo = outputVideo; } - - public Interaction( - @Nonnull InteractionStatus status) { - this(null, null, null, - status, null, null, - null, null, null, - null, null, null, - null, null, null, - null, null, null, - null, null, null, - null, null, null, - null, null, null, - null); + + public Interaction(@Nonnull InteractionStatus status) { + this( + null, + null, + null, + status, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null); } /** @@ -399,7 +415,7 @@ public Optional usage() { /** * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -409,7 +425,7 @@ public Optional> responseModalities() { /** * The mime type of the response. This is required if response_format is set. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -503,7 +519,7 @@ public Optional input() { /** * Concatenated text from the last model output in response to the current request. - * + * *

Note: this is added by the SDK. */ public Optional outputText() { @@ -546,7 +562,6 @@ public static Builder builder() { return new Builder(); } - /** * The model that will complete your prompt.\n\nSee * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. @@ -556,7 +571,6 @@ public Interaction withModel(@Nullable Model model) { return this; } - /** * The agent to interact with. */ @@ -565,7 +579,6 @@ public Interaction withAgent(@Nullable AgentOption agent) { return this; } - /** * Required. Output only. A unique identifier for the interaction completion. */ @@ -574,7 +587,6 @@ public Interaction withId(@Nullable String id) { return this; } - /** * Required. Output only. The status of the interaction. */ @@ -583,7 +595,6 @@ public Interaction withStatus(@Nonnull InteractionStatus status) { return this; } - /** * Output only. The time at which the response was created in ISO 8601 format * (YYYY-MM-DDThh:mm:ssZ). @@ -593,7 +604,6 @@ public Interaction withCreated(@Nullable String created) { return this; } - /** * Output only. The time at which the response was last updated in ISO 8601 format * (YYYY-MM-DDThh:mm:ssZ). @@ -603,7 +613,6 @@ public Interaction withUpdated(@Nullable String updated) { return this; } - /** * System instruction for the interaction. */ @@ -612,7 +621,6 @@ public Interaction withSystemInstruction(@Nullable String systemInstruction) { return this; } - /** * A list of tool declarations the model may call during interaction. */ @@ -621,7 +629,6 @@ public Interaction withTools(@Nullable List tools) { return this; } - /** * Output only. Diagnostic faults / platform errors recorded on the interaction. */ @@ -630,7 +637,6 @@ public Interaction withErrors(@Nullable List errors) { return this; } - /** * Statistics on the interaction request's token usage. */ @@ -639,10 +645,9 @@ public Interaction withUsage(@Nullable Usage usage) { return this; } - /** * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -651,10 +656,9 @@ public Interaction withResponseModalities(@Nullable List respo return this; } - /** * The mime type of the response. This is required if response_format is set. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -663,7 +667,6 @@ public Interaction withResponseMimeType(@Nullable String responseMimeType) { return this; } - /** * The ID of the previous interaction, if any. */ @@ -672,7 +675,6 @@ public Interaction withPreviousInteractionId(@Nullable String previousInteractio return this; } - /** * Output only. The environment ID for the interaction. Only populated if environment * config is set in the request. @@ -682,13 +684,11 @@ public Interaction withEnvironmentId(@Nullable String environmentId) { return this; } - public Interaction withServiceTier(@Nullable ServiceTier serviceTier) { this.serviceTier = serviceTier; return this; } - /** * Message for configuring webhook events for a request. */ @@ -697,7 +697,6 @@ public Interaction withWebhookConfig(@Nullable WebhookConfig webhookConfig) { return this; } - /** * Output only. The steps that make up the interaction, when included in the response. */ @@ -706,7 +705,6 @@ public Interaction withSteps(@Nullable List steps) { return this; } - /** * Enforces that the generated response is a JSON object that complies with the JSON schema specified * in this field. @@ -716,7 +714,6 @@ public Interaction withResponseFormat(@Nullable InteractionResponseFormat respon return this; } - /** * The environment configuration for the interaction. Can be an object specifying remote environment * sources or a string referencing an existing environment ID. @@ -726,7 +723,6 @@ public Interaction withEnvironment(@Nullable InteractionEnvironment environment) return this; } - /** * Configuration parameters for model interactions. */ @@ -735,7 +731,6 @@ public Interaction withGenerationConfig(@Nullable GenerationConfig generationCon return this; } - /** * Configuration parameters for the agent interaction. */ @@ -744,7 +739,6 @@ public Interaction withAgentConfig(@Nullable InteractionAgentConfig agentConfig) return this; } - /** * Safety settings for the interaction. */ @@ -753,7 +747,6 @@ public Interaction withSafetySettings(@Nullable List safetySettin return this; } - /** * The labels with user-defined metadata for the request. */ @@ -762,7 +755,6 @@ public Interaction withLabels(@Nullable Map labels) { return this; } - /** * The input for the interaction. */ @@ -771,10 +763,9 @@ public Interaction withInput(@Nullable InteractionsInput input) { return this; } - /** * Concatenated text from the last model output in response to the current request. - * + * *

Note: this is added by the SDK. */ public Interaction withOutputText(@Nullable String outputText) { @@ -782,7 +773,6 @@ public Interaction withOutputText(@Nullable String outputText) { return this; } - /** * An image content block. */ @@ -791,7 +781,6 @@ public Interaction withOutputImage(@Nullable ImageContent outputImage) { return this; } - /** * An audio content block. */ @@ -800,7 +789,6 @@ public Interaction withOutputAudio(@Nullable AudioContent outputAudio) { return this; } - /** * A video content block. */ @@ -809,7 +797,6 @@ public Interaction withOutputVideo(@Nullable VideoContent outputVideo) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -819,87 +806,133 @@ public boolean equals(java.lang.Object o) { return false; } Interaction other = (Interaction) o; - return - Utils.enhancedDeepEquals(this.model, other.model) && - Utils.enhancedDeepEquals(this.agent, other.agent) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.status, other.status) && - Utils.enhancedDeepEquals(this.created, other.created) && - Utils.enhancedDeepEquals(this.updated, other.updated) && - Utils.enhancedDeepEquals(this.systemInstruction, other.systemInstruction) && - Utils.enhancedDeepEquals(this.tools, other.tools) && - Utils.enhancedDeepEquals(this.errors, other.errors) && - Utils.enhancedDeepEquals(this.usage, other.usage) && - Utils.enhancedDeepEquals(this.responseModalities, other.responseModalities) && - Utils.enhancedDeepEquals(this.responseMimeType, other.responseMimeType) && - Utils.enhancedDeepEquals(this.previousInteractionId, other.previousInteractionId) && - Utils.enhancedDeepEquals(this.environmentId, other.environmentId) && - Utils.enhancedDeepEquals(this.serviceTier, other.serviceTier) && - Utils.enhancedDeepEquals(this.webhookConfig, other.webhookConfig) && - Utils.enhancedDeepEquals(this.steps, other.steps) && - Utils.enhancedDeepEquals(this.responseFormat, other.responseFormat) && - Utils.enhancedDeepEquals(this.environment, other.environment) && - Utils.enhancedDeepEquals(this.generationConfig, other.generationConfig) && - Utils.enhancedDeepEquals(this.agentConfig, other.agentConfig) && - Utils.enhancedDeepEquals(this.safetySettings, other.safetySettings) && - Utils.enhancedDeepEquals(this.labels, other.labels) && - Utils.enhancedDeepEquals(this.input, other.input) && - Utils.enhancedDeepEquals(this.outputText, other.outputText) && - Utils.enhancedDeepEquals(this.outputImage, other.outputImage) && - Utils.enhancedDeepEquals(this.outputAudio, other.outputAudio) && - Utils.enhancedDeepEquals(this.outputVideo, other.outputVideo); - } - + return Utils.enhancedDeepEquals(this.model, other.model) + && Utils.enhancedDeepEquals(this.agent, other.agent) + && Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.status, other.status) + && Utils.enhancedDeepEquals(this.created, other.created) + && Utils.enhancedDeepEquals(this.updated, other.updated) + && Utils.enhancedDeepEquals(this.systemInstruction, other.systemInstruction) + && Utils.enhancedDeepEquals(this.tools, other.tools) + && Utils.enhancedDeepEquals(this.errors, other.errors) + && Utils.enhancedDeepEquals(this.usage, other.usage) + && Utils.enhancedDeepEquals(this.responseModalities, other.responseModalities) + && Utils.enhancedDeepEquals(this.responseMimeType, other.responseMimeType) + && Utils.enhancedDeepEquals(this.previousInteractionId, other.previousInteractionId) + && Utils.enhancedDeepEquals(this.environmentId, other.environmentId) + && Utils.enhancedDeepEquals(this.serviceTier, other.serviceTier) + && Utils.enhancedDeepEquals(this.webhookConfig, other.webhookConfig) + && Utils.enhancedDeepEquals(this.steps, other.steps) + && Utils.enhancedDeepEquals(this.responseFormat, other.responseFormat) + && Utils.enhancedDeepEquals(this.environment, other.environment) + && Utils.enhancedDeepEquals(this.generationConfig, other.generationConfig) + && Utils.enhancedDeepEquals(this.agentConfig, other.agentConfig) + && Utils.enhancedDeepEquals(this.safetySettings, other.safetySettings) + && Utils.enhancedDeepEquals(this.labels, other.labels) + && Utils.enhancedDeepEquals(this.input, other.input) + && Utils.enhancedDeepEquals(this.outputText, other.outputText) + && Utils.enhancedDeepEquals(this.outputImage, other.outputImage) + && Utils.enhancedDeepEquals(this.outputAudio, other.outputAudio) + && Utils.enhancedDeepEquals(this.outputVideo, other.outputVideo); + } + @Override public int hashCode() { return Utils.enhancedHash( - model, agent, id, - status, created, updated, - systemInstruction, tools, errors, - usage, responseModalities, responseMimeType, - previousInteractionId, environmentId, serviceTier, - webhookConfig, steps, responseFormat, - environment, generationConfig, agentConfig, - safetySettings, labels, input, - outputText, outputImage, outputAudio, - outputVideo); - } - + model, + agent, + id, + status, + created, + updated, + systemInstruction, + tools, + errors, + usage, + responseModalities, + responseMimeType, + previousInteractionId, + environmentId, + serviceTier, + webhookConfig, + steps, + responseFormat, + environment, + generationConfig, + agentConfig, + safetySettings, + labels, + input, + outputText, + outputImage, + outputAudio, + outputVideo); + } + @Override public String toString() { - return Utils.toString(Interaction.class, - "model", model, - "agent", agent, - "id", id, - "status", status, - "created", created, - "updated", updated, - "systemInstruction", systemInstruction, - "tools", tools, - "errors", errors, - "usage", usage, - "responseModalities", responseModalities, - "responseMimeType", responseMimeType, - "previousInteractionId", previousInteractionId, - "environmentId", environmentId, - "serviceTier", serviceTier, - "webhookConfig", webhookConfig, - "steps", steps, - "responseFormat", responseFormat, - "environment", environment, - "generationConfig", generationConfig, - "agentConfig", agentConfig, - "safetySettings", safetySettings, - "labels", labels, - "input", input, - "outputText", outputText, - "outputImage", outputImage, - "outputAudio", outputAudio, - "outputVideo", outputVideo); + return Utils.toString( + Interaction.class, + "model", + model, + "agent", + agent, + "id", + id, + "status", + status, + "created", + created, + "updated", + updated, + "systemInstruction", + systemInstruction, + "tools", + tools, + "errors", + errors, + "usage", + usage, + "responseModalities", + responseModalities, + "responseMimeType", + responseMimeType, + "previousInteractionId", + previousInteractionId, + "environmentId", + environmentId, + "serviceTier", + serviceTier, + "webhookConfig", + webhookConfig, + "steps", + steps, + "responseFormat", + responseFormat, + "environment", + environment, + "generationConfig", + generationConfig, + "agentConfig", + agentConfig, + "safetySettings", + safetySettings, + "labels", + labels, + "input", + input, + "outputText", + outputText, + "outputImage", + outputImage, + "outputAudio", + outputAudio, + "outputVideo", + outputVideo); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Model model; @@ -960,7 +993,7 @@ public final static class Builder { private VideoContent outputVideo; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -1048,7 +1081,7 @@ public Builder usage(@Nullable Usage usage) { /** * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -1059,7 +1092,7 @@ public Builder responseModalities(@Nullable List responseModal /** * The mime type of the response. This is required if response_format is set. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -1166,7 +1199,7 @@ public Builder input(@Nullable InteractionsInput input) { /** * Concatenated text from the last model output in response to the current request. - * + * *

Note: this is added by the SDK. */ public Builder outputText(@Nullable String outputText) { @@ -1200,23 +1233,37 @@ public Builder outputVideo(@Nullable VideoContent outputVideo) { public Interaction build() { return new Interaction( - model, agent, id, - status, created, updated, - systemInstruction, tools, errors, - usage, responseModalities, responseMimeType, - previousInteractionId, environmentId, serviceTier, - webhookConfig, steps, responseFormat, - environment, generationConfig, agentConfig, - safetySettings, labels, input, - outputText, outputImage, outputAudio, - outputVideo); + model, + agent, + id, + status, + created, + updated, + systemInstruction, + tools, + errors, + usage, + responseModalities, + responseMimeType, + previousInteractionId, + environmentId, + serviceTier, + webhookConfig, + steps, + responseFormat, + environment, + generationConfig, + agentConfig, + safetySettings, + labels, + input, + outputText, + outputImage, + outputAudio, + outputVideo); } - private static final LazySingletonValue _SINGLETON_VALUE_Id = - new LazySingletonValue<>( - "id", - "\"\"", - new TypeReference() {}); + new LazySingletonValue<>("id", "\"\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionAgentConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionAgentConfig.java index d91d695d636..eff1126fa25 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionAgentConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionAgentConfig.java @@ -19,15 +19,15 @@ */ package com.google.genai.gaos.models.interactions; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; -import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver; import java.lang.String; /** * InteractionAgentConfig - * + * *

Configuration parameters for the agent interaction. */ @JsonTypeInfo( @@ -35,12 +35,9 @@ property = "type", include = As.EXISTING_PROPERTY, visible = true, - defaultImpl = UnknownInteractionAgentConfig.class -) + defaultImpl = UnknownInteractionAgentConfig.class) @JsonTypeIdResolver(InteractionAgentConfigTypeIdResolver.class) public interface InteractionAgentConfig { String type(); - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionAgentConfigTypeIdResolver.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionAgentConfigTypeIdResolver.java index 08c2b016423..5af18520112 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionAgentConfigTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionAgentConfigTypeIdResolver.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.google.genai.gaos.utils.GenericTypeIdResolver; @@ -26,10 +25,9 @@ import java.lang.Override; import java.lang.String; - /** * InteractionAgentConfigTypeIdResolver - * + * *

Configuration parameters for the agent interaction. */ public class InteractionAgentConfigTypeIdResolver extends GenericTypeIdResolver { @@ -51,19 +49,19 @@ public String idFromValue(Object value) { if (value == null) { return null; } - + // Handle known types by checking if they implement the discriminator method if (value instanceof InteractionAgentConfig) { InteractionAgentConfig discriminated = (InteractionAgentConfig) value; return discriminated.type(); } - - throw new IllegalArgumentException("Unknown value type: " + value.getClass().getName()); + + throw new IllegalArgumentException( + "Unknown value type: " + value.getClass().getName()); } @Override public String getDescForKnownTypeIds() { return "InteractionAgentConfig type resolver"; } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionCompletedEvent.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionCompletedEvent.java index 875426c90bd..131777fe49b 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionCompletedEvent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionCompletedEvent.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -32,7 +32,6 @@ import java.lang.String; import java.util.Optional; - public class InteractionCompletedEvent implements InteractionSSEEvent { @JsonProperty("event_type") @@ -61,11 +60,10 @@ public InteractionCompletedEvent( this.eventType = Builder._SINGLETON_VALUE_EventType.value(); this.eventId = eventId; this.interaction = Optional.ofNullable(interaction) - .orElseThrow(() -> new IllegalArgumentException("interaction cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("interaction cannot be null")); } - - public InteractionCompletedEvent( - @Nonnull InteractionSseEventInteraction interaction) { + + public InteractionCompletedEvent(@Nonnull InteractionSseEventInteraction interaction) { this(null, interaction); } @@ -95,7 +93,6 @@ public static Builder builder() { return new Builder(); } - /** * The event_id token to be used to resume the interaction stream, from * this event. @@ -105,7 +102,6 @@ public InteractionCompletedEvent withEventId(@Nullable String eventId) { return this; } - /** * Partial interaction resource emitted by interaction lifecycle SSE events. * Streaming lifecycle payloads may omit fields that are only available on @@ -116,7 +112,6 @@ public InteractionCompletedEvent withInteraction(@Nonnull InteractionSseEventInt return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -126,35 +121,37 @@ public boolean equals(java.lang.Object o) { return false; } InteractionCompletedEvent other = (InteractionCompletedEvent) o; - return - Utils.enhancedDeepEquals(this.eventType, other.eventType) && - Utils.enhancedDeepEquals(this.eventId, other.eventId) && - Utils.enhancedDeepEquals(this.interaction, other.interaction); + return Utils.enhancedDeepEquals(this.eventType, other.eventType) + && Utils.enhancedDeepEquals(this.eventId, other.eventId) + && Utils.enhancedDeepEquals(this.interaction, other.interaction); } - + @Override public int hashCode() { - return Utils.enhancedHash( - eventType, eventId, interaction); + return Utils.enhancedHash(eventType, eventId, interaction); } - + @Override public String toString() { - return Utils.toString(InteractionCompletedEvent.class, - "eventType", eventType, - "eventId", eventId, - "interaction", interaction); + return Utils.toString( + InteractionCompletedEvent.class, + "eventType", + eventType, + "eventId", + eventId, + "interaction", + interaction); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String eventId; private InteractionSseEventInteraction interaction; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -177,15 +174,10 @@ public Builder interaction(@Nonnull InteractionSseEventInteraction interaction) } public InteractionCompletedEvent build() { - return new InteractionCompletedEvent( - eventId, interaction); + return new InteractionCompletedEvent(eventId, interaction); } - private static final LazySingletonValue _SINGLETON_VALUE_EventType = - new LazySingletonValue<>( - "event_type", - "\"interaction.completed\"", - new TypeReference() {}); + new LazySingletonValue<>("event_type", "\"interaction.completed\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionCreatedEvent.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionCreatedEvent.java index 09883df7044..b6e74be469b 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionCreatedEvent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionCreatedEvent.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -32,7 +32,6 @@ import java.lang.String; import java.util.Optional; - public class InteractionCreatedEvent implements InteractionSSEEvent { @JsonProperty("event_type") @@ -61,11 +60,10 @@ public InteractionCreatedEvent( this.eventType = Builder._SINGLETON_VALUE_EventType.value(); this.eventId = eventId; this.interaction = Optional.ofNullable(interaction) - .orElseThrow(() -> new IllegalArgumentException("interaction cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("interaction cannot be null")); } - - public InteractionCreatedEvent( - @Nonnull InteractionSseEventInteraction interaction) { + + public InteractionCreatedEvent(@Nonnull InteractionSseEventInteraction interaction) { this(null, interaction); } @@ -95,7 +93,6 @@ public static Builder builder() { return new Builder(); } - /** * The event_id token to be used to resume the interaction stream, from * this event. @@ -105,7 +102,6 @@ public InteractionCreatedEvent withEventId(@Nullable String eventId) { return this; } - /** * Partial interaction resource emitted by interaction lifecycle SSE events. * Streaming lifecycle payloads may omit fields that are only available on @@ -116,7 +112,6 @@ public InteractionCreatedEvent withInteraction(@Nonnull InteractionSseEventInter return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -126,35 +121,31 @@ public boolean equals(java.lang.Object o) { return false; } InteractionCreatedEvent other = (InteractionCreatedEvent) o; - return - Utils.enhancedDeepEquals(this.eventType, other.eventType) && - Utils.enhancedDeepEquals(this.eventId, other.eventId) && - Utils.enhancedDeepEquals(this.interaction, other.interaction); + return Utils.enhancedDeepEquals(this.eventType, other.eventType) + && Utils.enhancedDeepEquals(this.eventId, other.eventId) + && Utils.enhancedDeepEquals(this.interaction, other.interaction); } - + @Override public int hashCode() { - return Utils.enhancedHash( - eventType, eventId, interaction); + return Utils.enhancedHash(eventType, eventId, interaction); } - + @Override public String toString() { - return Utils.toString(InteractionCreatedEvent.class, - "eventType", eventType, - "eventId", eventId, - "interaction", interaction); + return Utils.toString( + InteractionCreatedEvent.class, "eventType", eventType, "eventId", eventId, "interaction", interaction); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String eventId; private InteractionSseEventInteraction interaction; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -177,15 +168,10 @@ public Builder interaction(@Nonnull InteractionSseEventInteraction interaction) } public InteractionCreatedEvent build() { - return new InteractionCreatedEvent( - eventId, interaction); + return new InteractionCreatedEvent(eventId, interaction); } - private static final LazySingletonValue _SINGLETON_VALUE_EventType = - new LazySingletonValue<>( - "event_type", - "\"interaction.created\"", - new TypeReference() {}); + new LazySingletonValue<>("event_type", "\"interaction.created\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionEnvironment.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionEnvironment.java index 5a27bb344e4..020d518fc6a 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionEnvironment.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionEnvironment.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -35,7 +35,7 @@ /** * InteractionEnvironment - * + * *

The environment configuration for the interaction. Can be an object specifying remote environment * sources or a string referencing an existing environment ID. */ @@ -44,21 +44,21 @@ public class InteractionEnvironment { @JsonValue private final TypedObject value; - + private InteractionEnvironment(TypedObject value) { this.value = value; } public static InteractionEnvironment of(String value) { Utils.checkNotNull(value, "value"); - return new InteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new InteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static InteractionEnvironment of(Environment value) { Utils.checkNotNull(value, "value"); - return new InteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new InteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code String}, * otherwise returns an empty {@link Optional}. @@ -71,7 +71,7 @@ public Optional string() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code Environment}, * otherwise returns an empty {@link Optional}. @@ -84,19 +84,19 @@ public Optional environment() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -108,27 +108,26 @@ public boolean equals(java.lang.Object o) { InteractionEnvironment other = (InteractionEnvironment) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(InteractionEnvironment.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + InteractionEnvironment.class, + false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(InteractionEnvironment.class, - "value", value); + return Utils.toString(InteractionEnvironment.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionResponseFormat.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionResponseFormat.java index e5fb29b09cb..dcedad93bae 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionResponseFormat.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionResponseFormat.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -36,7 +36,7 @@ /** * InteractionResponseFormat - * + * *

Enforces that the generated response is a JSON object that complies with the JSON schema specified * in this field. */ @@ -45,21 +45,23 @@ public class InteractionResponseFormat { @JsonValue private final TypedObject value; - + private InteractionResponseFormat(TypedObject value) { this.value = value; } public static InteractionResponseFormat of(List value) { Utils.checkNotNull(value, "value"); - return new InteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new InteractionResponseFormat( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>() {})); } public static InteractionResponseFormat of(ResponseFormat value) { Utils.checkNotNull(value, "value"); - return new InteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new InteractionResponseFormat( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code List}, * otherwise returns an empty {@link Optional}. @@ -73,7 +75,7 @@ public Optional> arrayOfResponseFormat() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code ResponseFormat}, * otherwise returns an empty {@link Optional}. @@ -86,19 +88,19 @@ public Optional responseFormat() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -110,27 +112,26 @@ public boolean equals(java.lang.Object o) { InteractionResponseFormat other = (InteractionResponseFormat) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(InteractionResponseFormat.class, false, - TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + InteractionResponseFormat.class, + false, + TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(InteractionResponseFormat.class, - "value", value); + return Utils.toString(InteractionResponseFormat.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionSSEEvent.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionSSEEvent.java index 910d9f889ec..95c973b1b89 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionSSEEvent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionSSEEvent.java @@ -19,9 +19,9 @@ */ package com.google.genai.gaos.models.interactions; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; -import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver; import java.lang.String; @@ -30,12 +30,9 @@ property = "event_type", include = As.EXISTING_PROPERTY, visible = true, - defaultImpl = UnknownInteractionSSEEvent.class -) + defaultImpl = UnknownInteractionSSEEvent.class) @JsonTypeIdResolver(InteractionSSEEventTypeIdResolver.class) public interface InteractionSSEEvent { String eventType(); - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionSSEEventTypeIdResolver.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionSSEEventTypeIdResolver.java index 0eea3aeac6c..1a6b8a9854e 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionSSEEventTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionSSEEventTypeIdResolver.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.google.genai.gaos.utils.GenericTypeIdResolver; @@ -26,7 +25,6 @@ import java.lang.Override; import java.lang.String; - public class InteractionSSEEventTypeIdResolver extends GenericTypeIdResolver { public InteractionSSEEventTypeIdResolver() { @@ -49,19 +47,19 @@ public String idFromValue(Object value) { if (value == null) { return null; } - + // Handle known types by checking if they implement the discriminator method if (value instanceof InteractionSSEEvent) { InteractionSSEEvent discriminated = (InteractionSSEEvent) value; return discriminated.eventType(); } - - throw new IllegalArgumentException("Unknown value type: " + value.getClass().getName()); + + throw new IllegalArgumentException( + "Unknown value type: " + value.getClass().getName()); } @Override public String getDescForKnownTypeIds() { return "InteractionSSEEvent type resolver"; } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionSSEStreamEvent.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionSSEStreamEvent.java index e1f7c7ef2d0..117b73e222e 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionSSEStreamEvent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionSSEStreamEvent.java @@ -27,17 +27,14 @@ import java.lang.String; import java.util.Optional; - public class InteractionSSEStreamEvent { @JsonProperty("data") private InteractionSSEEvent data; @JsonCreator - public InteractionSSEStreamEvent( - @JsonProperty("data") @Nonnull InteractionSSEEvent data) { - this.data = Optional.ofNullable(data) - .orElseThrow(() -> new IllegalArgumentException("data cannot be null")); + public InteractionSSEStreamEvent(@JsonProperty("data") @Nonnull InteractionSSEEvent data) { + this.data = Optional.ofNullable(data).orElseThrow(() -> new IllegalArgumentException("data cannot be null")); } public Optional data() { @@ -48,13 +45,11 @@ public static Builder builder() { return new Builder(); } - public InteractionSSEStreamEvent withData(@Nonnull InteractionSSEEvent data) { this.data = Utils.checkNotNull(data, "data"); return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -64,29 +59,26 @@ public boolean equals(java.lang.Object o) { return false; } InteractionSSEStreamEvent other = (InteractionSSEStreamEvent) o; - return - Utils.enhancedDeepEquals(this.data, other.data); + return Utils.enhancedDeepEquals(this.data, other.data); } - + @Override public int hashCode() { - return Utils.enhancedHash( - data); + return Utils.enhancedHash(data); } - + @Override public String toString() { - return Utils.toString(InteractionSSEStreamEvent.class, - "data", data); + return Utils.toString(InteractionSSEStreamEvent.class, "data", data); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private InteractionSSEEvent data; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder data(@Nonnull InteractionSSEEvent data) { @@ -95,9 +87,7 @@ public Builder data(@Nonnull InteractionSSEEvent data) { } public InteractionSSEStreamEvent build() { - return new InteractionSSEStreamEvent( - data); + return new InteractionSSEStreamEvent(data); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionSseEventInteraction.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionSseEventInteraction.java index caf4c4e5aec..5ce0ab0c52e 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionSseEventInteraction.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionSseEventInteraction.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nonnull; @@ -33,7 +33,7 @@ /** * InteractionSseEventInteraction - * + * *

Partial interaction resource emitted by interaction lifecycle SSE events. * Streaming lifecycle payloads may omit fields that are only available on * full non-streaming Interaction responses. @@ -86,7 +86,6 @@ public class InteractionSseEventInteraction { @JsonProperty("updated") private String updated; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("service_tier") private ServiceTier serviceTier; @@ -117,27 +116,21 @@ public InteractionSseEventInteraction( @JsonProperty("service_tier") @Nullable ServiceTier serviceTier, @JsonProperty("usage") @Nullable Usage usage, @JsonProperty("steps") @Nullable List steps) { - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); this.object = object; this.model = model; this.agent = agent; - this.status = Optional.ofNullable(status) - .orElseThrow(() -> new IllegalArgumentException("status cannot be null")); + this.status = + Optional.ofNullable(status).orElseThrow(() -> new IllegalArgumentException("status cannot be null")); this.created = created; this.updated = updated; this.serviceTier = serviceTier; this.usage = usage; this.steps = steps; } - - public InteractionSseEventInteraction( - @Nonnull String id, - @Nonnull InteractionSseEventInteractionStatus status) { - this(id, null, null, - null, status, null, - null, null, null, - null); + + public InteractionSseEventInteraction(@Nonnull String id, @Nonnull InteractionSseEventInteractionStatus status) { + this(id, null, null, null, status, null, null, null, null, null); } /** @@ -211,7 +204,6 @@ public static Builder builder() { return new Builder(); } - /** * Required. Output only. A unique identifier for the interaction completion. */ @@ -220,7 +212,6 @@ public InteractionSseEventInteraction withId(@Nonnull String id) { return this; } - /** * Output only. The resource type. */ @@ -229,7 +220,6 @@ public InteractionSseEventInteraction withObject(@Nullable String object) { return this; } - /** * The model that will complete your prompt. */ @@ -238,7 +228,6 @@ public InteractionSseEventInteraction withModel(@Nullable String model) { return this; } - /** * The agent to interact with. */ @@ -247,7 +236,6 @@ public InteractionSseEventInteraction withAgent(@Nullable String agent) { return this; } - /** * Required. Output only. The status of the interaction. */ @@ -256,7 +244,6 @@ public InteractionSseEventInteraction withStatus(@Nonnull InteractionSseEventInt return this; } - /** * Output only. The time at which the response was created in ISO 8601 format. */ @@ -265,7 +252,6 @@ public InteractionSseEventInteraction withCreated(@Nullable String created) { return this; } - /** * Output only. The time at which the response was last updated in ISO 8601 format. */ @@ -274,13 +260,11 @@ public InteractionSseEventInteraction withUpdated(@Nullable String updated) { return this; } - public InteractionSseEventInteraction withServiceTier(@Nullable ServiceTier serviceTier) { this.serviceTier = serviceTier; return this; } - /** * Statistics on the interaction request's token usage. */ @@ -289,7 +273,6 @@ public InteractionSseEventInteraction withUsage(@Nullable Usage usage) { return this; } - /** * Output only. The steps that make up the interaction, if included in this event. */ @@ -298,7 +281,6 @@ public InteractionSseEventInteraction withSteps(@Nullable List steps) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -308,45 +290,51 @@ public boolean equals(java.lang.Object o) { return false; } InteractionSseEventInteraction other = (InteractionSseEventInteraction) o; - return - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.object, other.object) && - Utils.enhancedDeepEquals(this.model, other.model) && - Utils.enhancedDeepEquals(this.agent, other.agent) && - Utils.enhancedDeepEquals(this.status, other.status) && - Utils.enhancedDeepEquals(this.created, other.created) && - Utils.enhancedDeepEquals(this.updated, other.updated) && - Utils.enhancedDeepEquals(this.serviceTier, other.serviceTier) && - Utils.enhancedDeepEquals(this.usage, other.usage) && - Utils.enhancedDeepEquals(this.steps, other.steps); + return Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.object, other.object) + && Utils.enhancedDeepEquals(this.model, other.model) + && Utils.enhancedDeepEquals(this.agent, other.agent) + && Utils.enhancedDeepEquals(this.status, other.status) + && Utils.enhancedDeepEquals(this.created, other.created) + && Utils.enhancedDeepEquals(this.updated, other.updated) + && Utils.enhancedDeepEquals(this.serviceTier, other.serviceTier) + && Utils.enhancedDeepEquals(this.usage, other.usage) + && Utils.enhancedDeepEquals(this.steps, other.steps); } - + @Override public int hashCode() { - return Utils.enhancedHash( - id, object, model, - agent, status, created, - updated, serviceTier, usage, - steps); + return Utils.enhancedHash(id, object, model, agent, status, created, updated, serviceTier, usage, steps); } - + @Override public String toString() { - return Utils.toString(InteractionSseEventInteraction.class, - "id", id, - "object", object, - "model", model, - "agent", agent, - "status", status, - "created", created, - "updated", updated, - "serviceTier", serviceTier, - "usage", usage, - "steps", steps); + return Utils.toString( + InteractionSseEventInteraction.class, + "id", + id, + "object", + object, + "model", + model, + "agent", + agent, + "status", + status, + "created", + created, + "updated", + updated, + "serviceTier", + serviceTier, + "usage", + usage, + "steps", + steps); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String id; @@ -369,7 +357,7 @@ public final static class Builder { private List steps; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -451,11 +439,7 @@ public Builder steps(@Nullable List steps) { public InteractionSseEventInteraction build() { return new InteractionSseEventInteraction( - id, object, model, - agent, status, created, - updated, serviceTier, usage, - steps); + id, object, model, agent, status, created, updated, serviceTier, usage, steps); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionSseEventInteractionStatus.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionSseEventInteractionStatus.java index edd4178911e..e539a0e8256 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionSseEventInteractionStatus.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionSseEventInteractionStatus.java @@ -36,17 +36,23 @@ */ /** * InteractionSseEventInteractionStatus - * + * *

Required. Output only. The status of the interaction. */ public class InteractionSseEventInteractionStatus { - public static final InteractionSseEventInteractionStatus IN_PROGRESS = new InteractionSseEventInteractionStatus("in_progress"); - public static final InteractionSseEventInteractionStatus REQUIRES_ACTION = new InteractionSseEventInteractionStatus("requires_action"); - public static final InteractionSseEventInteractionStatus COMPLETED = new InteractionSseEventInteractionStatus("completed"); - public static final InteractionSseEventInteractionStatus FAILED = new InteractionSseEventInteractionStatus("failed"); - public static final InteractionSseEventInteractionStatus CANCELLED = new InteractionSseEventInteractionStatus("cancelled"); - public static final InteractionSseEventInteractionStatus INCOMPLETE = new InteractionSseEventInteractionStatus("incomplete"); + public static final InteractionSseEventInteractionStatus IN_PROGRESS = + new InteractionSseEventInteractionStatus("in_progress"); + public static final InteractionSseEventInteractionStatus REQUIRES_ACTION = + new InteractionSseEventInteractionStatus("requires_action"); + public static final InteractionSseEventInteractionStatus COMPLETED = + new InteractionSseEventInteractionStatus("completed"); + public static final InteractionSseEventInteractionStatus FAILED = + new InteractionSseEventInteractionStatus("failed"); + public static final InteractionSseEventInteractionStatus CANCELLED = + new InteractionSseEventInteractionStatus("cancelled"); + public static final InteractionSseEventInteractionStatus INCOMPLETE = + new InteractionSseEventInteractionStatus("incomplete"); // This map will grow whenever a Color gets created with a new // unrecognized value (a potential memory leak if the user is not @@ -63,12 +69,12 @@ private InteractionSseEventInteractionStatus(String value) { } /** - * Returns a InteractionSseEventInteractionStatus with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a InteractionSseEventInteractionStatus with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as InteractionSseEventInteractionStatus - */ + */ @JsonCreator public static InteractionSseEventInteractionStatus of(String value) { synchronized (InteractionSseEventInteractionStatus.class) { @@ -96,12 +102,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; InteractionSseEventInteractionStatus other = (InteractionSseEventInteractionStatus) obj; return Objects.equals(value, other.value); } @@ -139,8 +142,7 @@ private static final Map creat map.put("incomplete", InteractionSseEventInteractionStatusEnum.INCOMPLETE); return map; } - - + public enum InteractionSseEventInteractionStatusEnum { IN_PROGRESS("in_progress"), @@ -148,7 +150,8 @@ public enum InteractionSseEventInteractionStatusEnum { COMPLETED("completed"), FAILED("failed"), CANCELLED("cancelled"), - INCOMPLETE("incomplete"),; + INCOMPLETE("incomplete"), + ; private final String value; @@ -161,4 +164,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionStatus.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionStatus.java index 0aaa6aa79d4..aa7b4e5692a 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionStatus.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionStatus.java @@ -36,7 +36,7 @@ */ /** * InteractionStatus - * + * *

Required. Output only. The status of the interaction. */ public class InteractionStatus { @@ -65,12 +65,12 @@ private InteractionStatus(String value) { } /** - * Returns a InteractionStatus with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a InteractionStatus with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as InteractionStatus - */ + */ @JsonCreator public static InteractionStatus of(String value) { synchronized (InteractionStatus.class) { @@ -98,12 +98,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; InteractionStatus other = (InteractionStatus) obj; return Objects.equals(value, other.value); } @@ -145,8 +142,7 @@ private static final Map createEnumsMap() { map.put("queued", InteractionStatusEnum.QUEUED); return map; } - - + public enum InteractionStatusEnum { IN_PROGRESS("in_progress"), @@ -156,7 +152,8 @@ public enum InteractionStatusEnum { CANCELLED("cancelled"), INCOMPLETE("incomplete"), BUDGET_EXCEEDED("budget_exceeded"), - QUEUED("queued"),; + QUEUED("queued"), + ; private final String value; @@ -169,4 +166,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionStatusUpdate.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionStatusUpdate.java index f4e2a19a05c..660c4cd3df1 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionStatusUpdate.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionStatusUpdate.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -32,7 +32,6 @@ import java.lang.String; import java.util.Optional; - public class InteractionStatusUpdate implements InteractionSSEEvent { /** * The event_id token to be used to resume the interaction stream, from @@ -42,15 +41,12 @@ public class InteractionStatusUpdate implements InteractionSSEEvent { @JsonProperty("event_id") private String eventId; - @JsonProperty("event_type") private String eventType; - @JsonProperty("interaction_id") private String interactionId; - @JsonProperty("status") private InteractionStatusUpdateStatus status; @@ -62,14 +58,12 @@ public InteractionStatusUpdate( this.eventId = eventId; this.eventType = Builder._SINGLETON_VALUE_EventType.value(); this.interactionId = Optional.ofNullable(interactionId) - .orElseThrow(() -> new IllegalArgumentException("interactionId cannot be null")); - this.status = Optional.ofNullable(status) - .orElseThrow(() -> new IllegalArgumentException("status cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("interactionId cannot be null")); + this.status = + Optional.ofNullable(status).orElseThrow(() -> new IllegalArgumentException("status cannot be null")); } - - public InteractionStatusUpdate( - @Nonnull String interactionId, - @Nonnull InteractionStatusUpdateStatus status) { + + public InteractionStatusUpdate(@Nonnull String interactionId, @Nonnull InteractionStatusUpdateStatus status) { this(null, interactionId, status); } @@ -98,7 +92,6 @@ public static Builder builder() { return new Builder(); } - /** * The event_id token to be used to resume the interaction stream, from * this event. @@ -108,19 +101,16 @@ public InteractionStatusUpdate withEventId(@Nullable String eventId) { return this; } - public InteractionStatusUpdate withInteractionId(@Nonnull String interactionId) { this.interactionId = Utils.checkNotNull(interactionId, "interactionId"); return this; } - public InteractionStatusUpdate withStatus(@Nonnull InteractionStatusUpdateStatus status) { this.status = Utils.checkNotNull(status, "status"); return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -130,31 +120,33 @@ public boolean equals(java.lang.Object o) { return false; } InteractionStatusUpdate other = (InteractionStatusUpdate) o; - return - Utils.enhancedDeepEquals(this.eventId, other.eventId) && - Utils.enhancedDeepEquals(this.eventType, other.eventType) && - Utils.enhancedDeepEquals(this.interactionId, other.interactionId) && - Utils.enhancedDeepEquals(this.status, other.status); + return Utils.enhancedDeepEquals(this.eventId, other.eventId) + && Utils.enhancedDeepEquals(this.eventType, other.eventType) + && Utils.enhancedDeepEquals(this.interactionId, other.interactionId) + && Utils.enhancedDeepEquals(this.status, other.status); } - + @Override public int hashCode() { - return Utils.enhancedHash( - eventId, eventType, interactionId, - status); + return Utils.enhancedHash(eventId, eventType, interactionId, status); } - + @Override public String toString() { - return Utils.toString(InteractionStatusUpdate.class, - "eventId", eventId, - "eventType", eventType, - "interactionId", interactionId, - "status", status); + return Utils.toString( + InteractionStatusUpdate.class, + "eventId", + eventId, + "eventType", + eventType, + "interactionId", + interactionId, + "status", + status); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String eventId; @@ -163,7 +155,7 @@ public final static class Builder { private InteractionStatusUpdateStatus status; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -186,15 +178,10 @@ public Builder status(@Nonnull InteractionStatusUpdateStatus status) { } public InteractionStatusUpdate build() { - return new InteractionStatusUpdate( - eventId, interactionId, status); + return new InteractionStatusUpdate(eventId, interactionId, status); } - private static final LazySingletonValue _SINGLETON_VALUE_EventType = - new LazySingletonValue<>( - "event_type", - "\"interaction.status_update\"", - new TypeReference() {}); + new LazySingletonValue<>("event_type", "\"interaction.status_update\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionStatusUpdateStatus.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionStatusUpdateStatus.java index 0ae5bf41544..3fe08a9f7ee 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionStatusUpdateStatus.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionStatusUpdateStatus.java @@ -37,12 +37,14 @@ public class InteractionStatusUpdateStatus { public static final InteractionStatusUpdateStatus IN_PROGRESS = new InteractionStatusUpdateStatus("in_progress"); - public static final InteractionStatusUpdateStatus REQUIRES_ACTION = new InteractionStatusUpdateStatus("requires_action"); + public static final InteractionStatusUpdateStatus REQUIRES_ACTION = + new InteractionStatusUpdateStatus("requires_action"); public static final InteractionStatusUpdateStatus COMPLETED = new InteractionStatusUpdateStatus("completed"); public static final InteractionStatusUpdateStatus FAILED = new InteractionStatusUpdateStatus("failed"); public static final InteractionStatusUpdateStatus CANCELLED = new InteractionStatusUpdateStatus("cancelled"); public static final InteractionStatusUpdateStatus INCOMPLETE = new InteractionStatusUpdateStatus("incomplete"); - public static final InteractionStatusUpdateStatus BUDGET_EXCEEDED = new InteractionStatusUpdateStatus("budget_exceeded"); + public static final InteractionStatusUpdateStatus BUDGET_EXCEEDED = + new InteractionStatusUpdateStatus("budget_exceeded"); public static final InteractionStatusUpdateStatus QUEUED = new InteractionStatusUpdateStatus("queued"); // This map will grow whenever a Color gets created with a new @@ -60,12 +62,12 @@ private InteractionStatusUpdateStatus(String value) { } /** - * Returns a InteractionStatusUpdateStatus with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a InteractionStatusUpdateStatus with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as InteractionStatusUpdateStatus - */ + */ @JsonCreator public static InteractionStatusUpdateStatus of(String value) { synchronized (InteractionStatusUpdateStatus.class) { @@ -93,12 +95,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; InteractionStatusUpdateStatus other = (InteractionStatusUpdateStatus) obj; return Objects.equals(value, other.value); } @@ -140,8 +139,7 @@ private static final Map createEnumsM map.put("queued", InteractionStatusUpdateStatusEnum.QUEUED); return map; } - - + public enum InteractionStatusUpdateStatusEnum { IN_PROGRESS("in_progress"), @@ -151,7 +149,8 @@ public enum InteractionStatusUpdateStatusEnum { CANCELLED("cancelled"), INCOMPLETE("incomplete"), BUDGET_EXCEEDED("budget_exceeded"), - QUEUED("queued"),; + QUEUED("queued"), + ; private final String value; @@ -164,4 +163,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionsInput.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionsInput.java index fb93aa2f18b..2d7aeca94a7 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionsInput.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionsInput.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -36,7 +36,7 @@ /** * InteractionsInput - * + * *

The input for the interaction. */ @JsonDeserialize(using = InteractionsInput._Deserializer.class) @@ -44,36 +44,31 @@ public class InteractionsInput { @JsonValue private final TypedObject value; - + private InteractionsInput(TypedObject value) { this.value = value; } public static InteractionsInput of(String value) { Utils.checkNotNull(value, "value"); - return new InteractionsInput(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new InteractionsInput(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static InteractionsInput ofStep(List value) { Utils.checkNotNull(value, "value"); - return new InteractionsInput(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new InteractionsInput(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>() {})); } public static InteractionsInput ofContent(List value) { Utils.checkNotNull(value, "value"); - return new InteractionsInput(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); - } - - public static InteractionsInput ofTurn(List value) { - Utils.checkNotNull(value, "value"); - return new InteractionsInput(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new InteractionsInput(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>() {})); } public static InteractionsInput of(Content value) { Utils.checkNotNull(value, "value"); - return new InteractionsInput(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new InteractionsInput(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code String}, * otherwise returns an empty {@link Optional}. @@ -86,7 +81,7 @@ public Optional string() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code List}, * otherwise returns an empty {@link Optional}. @@ -100,7 +95,7 @@ public Optional> arrayOfStep() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code List}, * otherwise returns an empty {@link Optional}. @@ -114,46 +109,32 @@ public Optional> arrayOfContent() { } return Optional.empty(); } - + /** - * Returns an {@link Optional} containing the value if it is of type {@code List}, + * Returns an {@link Optional} containing the value if it is of type {@code Content}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code List} value, or empty if not of this type + * @return an {@link Optional} containing the {@code Content} value, or empty if not of this type */ - @SuppressWarnings("unchecked") - public Optional> arrayOfTurn() { - if (value.value() instanceof List) { - return Optional.of((List) value.value()); + public Optional content() { + if (value.value() instanceof Content) { + return Optional.of((Content) value.value()); } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value if it is of type {@code Content}, - * otherwise returns an empty {@link Optional}. + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. * - * @return an {@link Optional} containing the {@code Content} value, or empty if not of this type + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type */ - public Optional content() { - if (value.value() instanceof Content) { - return Optional.of((Content) value.value()); + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -165,30 +146,28 @@ public boolean equals(java.lang.Object o) { InteractionsInput other = (InteractionsInput) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(InteractionsInput.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + InteractionsInput.class, + false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(InteractionsInput.class, - "value", value); + return Utils.toString(InteractionsInput.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Language.java b/src/main/java/com/google/genai/gaos/models/interactions/Language.java index e3c26914315..42d0cf26002 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Language.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Language.java @@ -36,7 +36,7 @@ */ /** * Language - * + * *

Programming language of the `code`. */ public class Language { @@ -58,12 +58,12 @@ private Language(String value) { } /** - * Returns a Language with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a Language with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as Language - */ + */ @JsonCreator public static Language of(String value) { synchronized (Language.class) { @@ -91,12 +91,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; Language other = (Language) obj; return Objects.equals(value, other.value); } @@ -124,11 +121,11 @@ private static final Map createEnumsMap() { map.put("python", LanguageEnum.PYTHON); return map; } - - + public enum LanguageEnum { - PYTHON("python"),; + PYTHON("python"), + ; private final String value; @@ -141,4 +138,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/MCPServer.java b/src/main/java/com/google/genai/gaos/models/interactions/MCPServer.java index f0b55db24c5..92ee4cbda6d 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/MCPServer.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/MCPServer.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.models.agents.AgentTool; @@ -36,7 +36,7 @@ /** * MCPServer - * + * *

A MCPServer is a server that can be called by the model to perform actions. */ public class MCPServer implements Tool, AgentTool { @@ -61,7 +61,6 @@ public class MCPServer implements Tool, AgentTool { @JsonProperty("name") private String name; - @JsonProperty("type") private String type; @@ -85,10 +84,9 @@ public MCPServer( this.type = Builder._SINGLETON_VALUE_Type.value(); this.url = url; } - + public MCPServer() { - this(null, null, null, - null); + this(null, null, null, null); } /** @@ -129,7 +127,6 @@ public static Builder builder() { return new Builder(); } - /** * The allowed tools. */ @@ -138,7 +135,6 @@ public MCPServer withAllowedTools(@Nullable List allowedTools) { return this; } - /** * Optional: Fields for authentication headers, timeouts, etc., if needed. */ @@ -147,7 +143,6 @@ public MCPServer withHeaders(@Nullable Map headers) { return this; } - /** * The name of the MCPServer. */ @@ -156,7 +151,6 @@ public MCPServer withName(@Nullable String name) { return this; } - /** * The full URL for the MCPServer endpoint. * Example: "https://api.example.com/mcp" @@ -166,7 +160,6 @@ public MCPServer withUrl(@Nullable String url) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -176,33 +169,36 @@ public boolean equals(java.lang.Object o) { return false; } MCPServer other = (MCPServer) o; - return - Utils.enhancedDeepEquals(this.allowedTools, other.allowedTools) && - Utils.enhancedDeepEquals(this.headers, other.headers) && - Utils.enhancedDeepEquals(this.name, other.name) && - Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.url, other.url); + return Utils.enhancedDeepEquals(this.allowedTools, other.allowedTools) + && Utils.enhancedDeepEquals(this.headers, other.headers) + && Utils.enhancedDeepEquals(this.name, other.name) + && Utils.enhancedDeepEquals(this.type, other.type) + && Utils.enhancedDeepEquals(this.url, other.url); } - + @Override public int hashCode() { - return Utils.enhancedHash( - allowedTools, headers, name, - type, url); + return Utils.enhancedHash(allowedTools, headers, name, type, url); } - + @Override public String toString() { - return Utils.toString(MCPServer.class, - "allowedTools", allowedTools, - "headers", headers, - "name", name, - "type", type, - "url", url); + return Utils.toString( + MCPServer.class, + "allowedTools", + allowedTools, + "headers", + headers, + "name", + name, + "type", + type, + "url", + url); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List allowedTools; @@ -213,7 +209,7 @@ public final static class Builder { private String url; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -250,16 +246,10 @@ public Builder url(@Nullable String url) { } public MCPServer build() { - return new MCPServer( - allowedTools, headers, name, - url); + return new MCPServer(allowedTools, headers, name, url); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"mcp_server\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"mcp_server\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolCallDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolCallDelta.java index 59143a04c14..7820de1ce11 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolCallDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolCallDelta.java @@ -31,21 +31,17 @@ import java.util.Map; import java.util.Optional; - public class MCPServerToolCallDelta implements StepDeltaData { @JsonProperty("arguments") private Map arguments; - @JsonProperty("name") private String name; - @JsonProperty("server_name") private String serverName; - @JsonProperty("type") private String type; @@ -56,11 +52,10 @@ public MCPServerToolCallDelta( @JsonProperty("server_name") @Nonnull String serverName) { arguments = Utils.emptyMapIfNull(arguments); this.arguments = Optional.ofNullable(arguments) - .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); - this.name = Optional.ofNullable(name) - .orElseThrow(() -> new IllegalArgumentException("name cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); + this.name = Optional.ofNullable(name).orElseThrow(() -> new IllegalArgumentException("name cannot be null")); this.serverName = Optional.ofNullable(serverName) - .orElseThrow(() -> new IllegalArgumentException("serverName cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("serverName cannot be null")); this.type = Builder._SINGLETON_VALUE_Type.value(); } @@ -85,25 +80,21 @@ public static Builder builder() { return new Builder(); } - public MCPServerToolCallDelta withArguments(@Nonnull Map arguments) { this.arguments = Utils.checkNotNull(arguments, "arguments"); return this; } - public MCPServerToolCallDelta withName(@Nonnull String name) { this.name = Utils.checkNotNull(name, "name"); return this; } - public MCPServerToolCallDelta withServerName(@Nonnull String serverName) { this.serverName = Utils.checkNotNull(serverName, "serverName"); return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -113,31 +104,33 @@ public boolean equals(java.lang.Object o) { return false; } MCPServerToolCallDelta other = (MCPServerToolCallDelta) o; - return - Utils.enhancedDeepEquals(this.arguments, other.arguments) && - Utils.enhancedDeepEquals(this.name, other.name) && - Utils.enhancedDeepEquals(this.serverName, other.serverName) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.arguments, other.arguments) + && Utils.enhancedDeepEquals(this.name, other.name) + && Utils.enhancedDeepEquals(this.serverName, other.serverName) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - arguments, name, serverName, - type); + return Utils.enhancedHash(arguments, name, serverName, type); } - + @Override public String toString() { - return Utils.toString(MCPServerToolCallDelta.class, - "arguments", arguments, - "name", name, - "serverName", serverName, - "type", type); + return Utils.toString( + MCPServerToolCallDelta.class, + "arguments", + arguments, + "name", + name, + "serverName", + serverName, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Map arguments; @@ -146,7 +139,7 @@ public final static class Builder { private String serverName; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder arguments(@Nonnull Map arguments) { @@ -165,15 +158,10 @@ public Builder serverName(@Nonnull String serverName) { } public MCPServerToolCallDelta build() { - return new MCPServerToolCallDelta( - arguments, name, serverName); + return new MCPServerToolCallDelta(arguments, name, serverName); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"mcp_server_tool_call\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"mcp_server_tool_call\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolCallStep.java b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolCallStep.java index 12fa10e99e8..ae83f7b0494 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolCallStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolCallStep.java @@ -33,7 +33,7 @@ /** * MCPServerToolCallStep - * + * *

MCPServer tool call step. */ public class MCPServerToolCallStep implements Step { @@ -61,7 +61,6 @@ public class MCPServerToolCallStep implements Step { @JsonProperty("server_name") private String serverName; - @JsonProperty("type") private String type; @@ -73,13 +72,11 @@ public MCPServerToolCallStep( @JsonProperty("server_name") @Nonnull String serverName) { arguments = Utils.emptyMapIfNull(arguments); this.arguments = Optional.ofNullable(arguments) - .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); - this.name = Optional.ofNullable(name) - .orElseThrow(() -> new IllegalArgumentException("name cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.name = Optional.ofNullable(name).orElseThrow(() -> new IllegalArgumentException("name cannot be null")); this.serverName = Optional.ofNullable(serverName) - .orElseThrow(() -> new IllegalArgumentException("serverName cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("serverName cannot be null")); this.type = Builder._SINGLETON_VALUE_Type.value(); } @@ -120,7 +117,6 @@ public static Builder builder() { return new Builder(); } - /** * Required. The JSON object of arguments for the function. */ @@ -129,7 +125,6 @@ public MCPServerToolCallStep withArguments(@Nonnull Map argument return this; } - /** * Required. A unique ID for this specific tool call. */ @@ -138,7 +133,6 @@ public MCPServerToolCallStep withId(@Nonnull String id) { return this; } - /** * Required. The name of the tool which was called. */ @@ -147,7 +141,6 @@ public MCPServerToolCallStep withName(@Nonnull String name) { return this; } - /** * Required. The name of the used MCP server. */ @@ -156,7 +149,6 @@ public MCPServerToolCallStep withServerName(@Nonnull String serverName) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -166,33 +158,36 @@ public boolean equals(java.lang.Object o) { return false; } MCPServerToolCallStep other = (MCPServerToolCallStep) o; - return - Utils.enhancedDeepEquals(this.arguments, other.arguments) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.name, other.name) && - Utils.enhancedDeepEquals(this.serverName, other.serverName) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.arguments, other.arguments) + && Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.name, other.name) + && Utils.enhancedDeepEquals(this.serverName, other.serverName) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - arguments, id, name, - serverName, type); + return Utils.enhancedHash(arguments, id, name, serverName, type); } - + @Override public String toString() { - return Utils.toString(MCPServerToolCallStep.class, - "arguments", arguments, - "id", id, - "name", name, - "serverName", serverName, - "type", type); + return Utils.toString( + MCPServerToolCallStep.class, + "arguments", + arguments, + "id", + id, + "name", + name, + "serverName", + serverName, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Map arguments; @@ -203,7 +198,7 @@ public final static class Builder { private String serverName; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -239,16 +234,10 @@ public Builder serverName(@Nonnull String serverName) { } public MCPServerToolCallStep build() { - return new MCPServerToolCallStep( - arguments, id, name, - serverName); + return new MCPServerToolCallStep(arguments, id, name, serverName); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"mcp_server_tool_call\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"mcp_server_tool_call\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultDelta.java index 271785134a8..804ec5161ae 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -32,23 +32,19 @@ import java.lang.String; import java.util.Optional; - public class MCPServerToolResultDelta implements StepDeltaData { @JsonInclude(Include.NON_ABSENT) @JsonProperty("name") private String name; - @JsonProperty("result") private MCPServerToolResultDeltaResultUnion result; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("server_name") private String serverName; - @JsonProperty("type") private String type; @@ -58,14 +54,13 @@ public MCPServerToolResultDelta( @JsonProperty("result") @Nonnull MCPServerToolResultDeltaResultUnion result, @JsonProperty("server_name") @Nullable String serverName) { this.name = name; - this.result = Optional.ofNullable(result) - .orElseThrow(() -> new IllegalArgumentException("result cannot be null")); + this.result = + Optional.ofNullable(result).orElseThrow(() -> new IllegalArgumentException("result cannot be null")); this.serverName = serverName; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public MCPServerToolResultDelta( - @Nonnull MCPServerToolResultDeltaResultUnion result) { + + public MCPServerToolResultDelta(@Nonnull MCPServerToolResultDeltaResultUnion result) { this(null, result, null); } @@ -90,25 +85,21 @@ public static Builder builder() { return new Builder(); } - public MCPServerToolResultDelta withName(@Nullable String name) { this.name = name; return this; } - public MCPServerToolResultDelta withResult(@Nonnull MCPServerToolResultDeltaResultUnion result) { this.result = Utils.checkNotNull(result, "result"); return this; } - public MCPServerToolResultDelta withServerName(@Nullable String serverName) { this.serverName = serverName; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -118,31 +109,25 @@ public boolean equals(java.lang.Object o) { return false; } MCPServerToolResultDelta other = (MCPServerToolResultDelta) o; - return - Utils.enhancedDeepEquals(this.name, other.name) && - Utils.enhancedDeepEquals(this.result, other.result) && - Utils.enhancedDeepEquals(this.serverName, other.serverName) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.name, other.name) + && Utils.enhancedDeepEquals(this.result, other.result) + && Utils.enhancedDeepEquals(this.serverName, other.serverName) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - name, result, serverName, - type); + return Utils.enhancedHash(name, result, serverName, type); } - + @Override public String toString() { - return Utils.toString(MCPServerToolResultDelta.class, - "name", name, - "result", result, - "serverName", serverName, - "type", type); + return Utils.toString( + MCPServerToolResultDelta.class, "name", name, "result", result, "serverName", serverName, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String name; @@ -151,7 +136,7 @@ public final static class Builder { private String serverName; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder name(@Nullable String name) { @@ -170,15 +155,10 @@ public Builder serverName(@Nullable String serverName) { } public MCPServerToolResultDelta build() { - return new MCPServerToolResultDelta( - name, result, serverName); + return new MCPServerToolResultDelta(name, result, serverName); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"mcp_server_tool_result\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"mcp_server_tool_result\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultDeltaResult.java b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultDeltaResult.java index 5d8b50c4e52..2b5427ab1b5 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultDeltaResult.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultDeltaResult.java @@ -24,17 +24,14 @@ import java.lang.Override; import java.lang.String; - public class MCPServerToolResultDeltaResult { @JsonCreator - public MCPServerToolResultDeltaResult() { - } + public MCPServerToolResultDeltaResult() {} public static Builder builder() { return new Builder(); } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -45,29 +42,26 @@ public boolean equals(java.lang.Object o) { } return true; } - + @Override public int hashCode() { - return Utils.enhancedHash( - ); + return Utils.enhancedHash(); } - + @Override public String toString() { return Utils.toString(MCPServerToolResultDeltaResult.class); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Builder() { - // force use of static builder() method + // force use of static builder() method } public MCPServerToolResultDeltaResult build() { - return new MCPServerToolResultDeltaResult( - ); + return new MCPServerToolResultDeltaResult(); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultDeltaResultUnion.java b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultDeltaResultUnion.java index 1c53921d13c..c69e7aabb38 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultDeltaResultUnion.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultDeltaResultUnion.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -39,26 +39,29 @@ public class MCPServerToolResultDeltaResultUnion { @JsonValue private final TypedObject value; - + private MCPServerToolResultDeltaResultUnion(TypedObject value) { this.value = value; } public static MCPServerToolResultDeltaResultUnion of(MCPServerToolResultDeltaResult value) { Utils.checkNotNull(value, "value"); - return new MCPServerToolResultDeltaResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new MCPServerToolResultDeltaResultUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static MCPServerToolResultDeltaResultUnion of(List value) { Utils.checkNotNull(value, "value"); - return new MCPServerToolResultDeltaResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new MCPServerToolResultDeltaResultUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>() {})); } public static MCPServerToolResultDeltaResultUnion of(String value) { Utils.checkNotNull(value, "value"); - return new MCPServerToolResultDeltaResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new MCPServerToolResultDeltaResultUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code MCPServerToolResultDeltaResult}, * otherwise returns an empty {@link Optional}. @@ -71,7 +74,7 @@ public Optional mcpServerToolResultDeltaResult() } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code List}, * otherwise returns an empty {@link Optional}. @@ -85,7 +88,7 @@ public Optional> arrayOfFunctionResultSubcontent( } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code String}, * otherwise returns an empty {@link Optional}. @@ -98,19 +101,19 @@ public Optional string() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -122,28 +125,29 @@ public boolean equals(java.lang.Object o) { MCPServerToolResultDeltaResultUnion other = (MCPServerToolResultDeltaResultUnion) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(MCPServerToolResultDeltaResultUnion.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + MCPServerToolResultDeltaResultUnion.class, + false, + TypeReferenceWithShape.of( + new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of( + new TypeReference>() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(MCPServerToolResultDeltaResultUnion.class, - "value", value); + return Utils.toString(MCPServerToolResultDeltaResultUnion.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultStep.java b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultStep.java index c2ef033c71b..4b6ef74d6c6 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultStep.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * MCPServerToolResultStep - * + * *

MCPServer tool result step. */ public class MCPServerToolResultStep implements Step { @@ -64,7 +64,6 @@ public class MCPServerToolResultStep implements Step { @JsonProperty("server_name") private String serverName; - @JsonProperty("type") private String type; @@ -74,20 +73,17 @@ public MCPServerToolResultStep( @JsonProperty("name") @Nullable String name, @JsonProperty("result") @Nonnull MCPServerToolResultStepResultUnion result, @JsonProperty("server_name") @Nullable String serverName) { - this.callId = Optional.ofNullable(callId) - .orElseThrow(() -> new IllegalArgumentException("callId cannot be null")); + this.callId = + Optional.ofNullable(callId).orElseThrow(() -> new IllegalArgumentException("callId cannot be null")); this.name = name; - this.result = Optional.ofNullable(result) - .orElseThrow(() -> new IllegalArgumentException("result cannot be null")); + this.result = + Optional.ofNullable(result).orElseThrow(() -> new IllegalArgumentException("result cannot be null")); this.serverName = serverName; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public MCPServerToolResultStep( - @Nonnull String callId, - @Nonnull MCPServerToolResultStepResultUnion result) { - this(callId, null, result, - null); + + public MCPServerToolResultStep(@Nonnull String callId, @Nonnull MCPServerToolResultStepResultUnion result) { + this(callId, null, result, null); } /** @@ -127,7 +123,6 @@ public static Builder builder() { return new Builder(); } - /** * Required. ID to match the ID from the function call block. */ @@ -136,7 +131,6 @@ public MCPServerToolResultStep withCallId(@Nonnull String callId) { return this; } - /** * Name of the tool which is called for this specific tool call. */ @@ -145,7 +139,6 @@ public MCPServerToolResultStep withName(@Nullable String name) { return this; } - /** * Required. The output from the MCP server call. Can be simple text or rich content. */ @@ -154,7 +147,6 @@ public MCPServerToolResultStep withResult(@Nonnull MCPServerToolResultStepResult return this; } - /** * The name of the used MCP server. */ @@ -163,7 +155,6 @@ public MCPServerToolResultStep withServerName(@Nullable String serverName) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -173,33 +164,36 @@ public boolean equals(java.lang.Object o) { return false; } MCPServerToolResultStep other = (MCPServerToolResultStep) o; - return - Utils.enhancedDeepEquals(this.callId, other.callId) && - Utils.enhancedDeepEquals(this.name, other.name) && - Utils.enhancedDeepEquals(this.result, other.result) && - Utils.enhancedDeepEquals(this.serverName, other.serverName) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.callId, other.callId) + && Utils.enhancedDeepEquals(this.name, other.name) + && Utils.enhancedDeepEquals(this.result, other.result) + && Utils.enhancedDeepEquals(this.serverName, other.serverName) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - callId, name, result, - serverName, type); + return Utils.enhancedHash(callId, name, result, serverName, type); } - + @Override public String toString() { - return Utils.toString(MCPServerToolResultStep.class, - "callId", callId, - "name", name, - "result", result, - "serverName", serverName, - "type", type); + return Utils.toString( + MCPServerToolResultStep.class, + "callId", + callId, + "name", + name, + "result", + result, + "serverName", + serverName, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String callId; @@ -210,7 +204,7 @@ public final static class Builder { private String serverName; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -246,16 +240,10 @@ public Builder serverName(@Nullable String serverName) { } public MCPServerToolResultStep build() { - return new MCPServerToolResultStep( - callId, name, result, - serverName); + return new MCPServerToolResultStep(callId, name, result, serverName); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"mcp_server_tool_result\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"mcp_server_tool_result\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultStepResult.java b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultStepResult.java index 2bd54671726..f2a0ce8922f 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultStepResult.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultStepResult.java @@ -24,17 +24,14 @@ import java.lang.Override; import java.lang.String; - public class MCPServerToolResultStepResult { @JsonCreator - public MCPServerToolResultStepResult() { - } + public MCPServerToolResultStepResult() {} public static Builder builder() { return new Builder(); } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -45,29 +42,26 @@ public boolean equals(java.lang.Object o) { } return true; } - + @Override public int hashCode() { - return Utils.enhancedHash( - ); + return Utils.enhancedHash(); } - + @Override public String toString() { return Utils.toString(MCPServerToolResultStepResult.class); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Builder() { - // force use of static builder() method + // force use of static builder() method } public MCPServerToolResultStepResult build() { - return new MCPServerToolResultStepResult( - ); + return new MCPServerToolResultStepResult(); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultStepResultUnion.java b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultStepResultUnion.java index 70aa7daa0e2..50411b2619c 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultStepResultUnion.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultStepResultUnion.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -36,7 +36,7 @@ /** * MCPServerToolResultStepResultUnion - * + * *

Required. The output from the MCP server call. Can be simple text or rich content. */ @JsonDeserialize(using = MCPServerToolResultStepResultUnion._Deserializer.class) @@ -44,26 +44,29 @@ public class MCPServerToolResultStepResultUnion { @JsonValue private final TypedObject value; - + private MCPServerToolResultStepResultUnion(TypedObject value) { this.value = value; } public static MCPServerToolResultStepResultUnion of(MCPServerToolResultStepResult value) { Utils.checkNotNull(value, "value"); - return new MCPServerToolResultStepResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new MCPServerToolResultStepResultUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static MCPServerToolResultStepResultUnion of(String value) { Utils.checkNotNull(value, "value"); - return new MCPServerToolResultStepResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new MCPServerToolResultStepResultUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static MCPServerToolResultStepResultUnion of(List value) { Utils.checkNotNull(value, "value"); - return new MCPServerToolResultStepResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new MCPServerToolResultStepResultUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code MCPServerToolResultStepResult}, * otherwise returns an empty {@link Optional}. @@ -76,7 +79,7 @@ public Optional mcpServerToolResultStepResult() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code String}, * otherwise returns an empty {@link Optional}. @@ -89,7 +92,7 @@ public Optional string() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code List}, * otherwise returns an empty {@link Optional}. @@ -103,19 +106,19 @@ public Optional> arrayOfFunctionResultSubcontent( } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -127,28 +130,29 @@ public boolean equals(java.lang.Object o) { MCPServerToolResultStepResultUnion other = (MCPServerToolResultStepResultUnion) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(MCPServerToolResultStepResultUnion.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT)); + super( + MCPServerToolResultStepResultUnion.class, + false, + TypeReferenceWithShape.of( + new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of( + new TypeReference>() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(MCPServerToolResultStepResultUnion.class, - "value", value); + return Utils.toString(MCPServerToolResultStepResultUnion.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/MediaProcessing.java b/src/main/java/com/google/genai/gaos/models/interactions/MediaProcessing.java new file mode 100644 index 00000000000..b9a6146451b --- /dev/null +++ b/src/main/java/com/google/genai/gaos/models/interactions/MediaProcessing.java @@ -0,0 +1,109 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.google.genai.gaos.models.interactions; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.genai.gaos.utils.OneOfDeserializer; +import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; +import com.google.genai.gaos.utils.Utils.JsonShape; +import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Optional; + +@JsonDeserialize(using = MediaProcessing._Deserializer.class) +public class MediaProcessing { + + @JsonValue + private final TypedObject value; + + private MediaProcessing(TypedObject value) { + this.value = value; + } + + public static MediaProcessing of(StaticMediaProcessing value) { + Utils.checkNotNull(value, "value"); + return new MediaProcessing( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); + } + + /** + * Returns an {@link Optional} containing the value if it is of type {@code StaticMediaProcessing}, + * otherwise returns an empty {@link Optional}. + * + * @return an {@link Optional} containing the {@code StaticMediaProcessing} value, or empty if not of this type + */ + public Optional staticMediaProcessing() { + if (value.value() instanceof StaticMediaProcessing) { + return Optional.of((StaticMediaProcessing) value.value()); + } + return Optional.empty(); + } + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MediaProcessing other = (MediaProcessing) o; + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); + } + + @Override + public int hashCode() { + return Utils.enhancedHash(value.value()); + } + + @SuppressWarnings("serial") + public static final class _Deserializer extends OneOfDeserializer { + + public _Deserializer() { + super( + MediaProcessing.class, + false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + } + } + + @Override + public String toString() { + return Utils.toString(MediaProcessing.class, "value", value); + } +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/MediaResolution.java b/src/main/java/com/google/genai/gaos/models/interactions/MediaResolution.java index ffaf8c3459d..01d2f28de11 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/MediaResolution.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/MediaResolution.java @@ -56,12 +56,12 @@ private MediaResolution(String value) { } /** - * Returns a MediaResolution with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a MediaResolution with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as MediaResolution - */ + */ @JsonCreator public static MediaResolution of(String value) { synchronized (MediaResolution.class) { @@ -89,12 +89,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; MediaResolution other = (MediaResolution) obj; return Objects.equals(value, other.value); } @@ -128,14 +125,14 @@ private static final Map createEnumsMap() { map.put("ultra_high", MediaResolutionEnum.ULTRA_HIGH); return map; } - - + public enum MediaResolutionEnum { LOW("low"), MEDIUM("medium"), HIGH("high"), - ULTRA_HIGH("ultra_high"),; + ULTRA_HIGH("ultra_high"), + ; private final String value; @@ -148,4 +145,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Method.java b/src/main/java/com/google/genai/gaos/models/interactions/Method.java index 3946f12bfea..af8bc06e2c0 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Method.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Method.java @@ -36,7 +36,7 @@ */ /** * Method - * + * *

Optional. The method for blocking content. If not specified, the default * behavior is to use the probability score. */ @@ -60,12 +60,12 @@ private Method(String value) { } /** - * Returns a Method with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a Method with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as Method - */ + */ @JsonCreator public static Method of(String value) { synchronized (Method.class) { @@ -93,12 +93,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; Method other = (Method) obj; return Objects.equals(value, other.value); } @@ -128,12 +125,12 @@ private static final Map createEnumsMap() { map.put("probability", MethodEnum.PROBABILITY); return map; } - - + public enum MethodEnum { SEVERITY("severity"), - PROBABILITY("probability"),; + PROBABILITY("probability"), + ; private final String value; @@ -146,4 +143,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ModalityTokens.java b/src/main/java/com/google/genai/gaos/models/interactions/ModalityTokens.java index 550af17f524..3ffbdbde9b2 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ModalityTokens.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ModalityTokens.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * ModalityTokens - * + * *

The token count for a single response modality. */ public class ModalityTokens { @@ -55,7 +55,7 @@ public ModalityTokens( this.modality = modality; this.tokens = tokens; } - + public ModalityTokens() { this(null, null); } @@ -75,13 +75,11 @@ public static Builder builder() { return new Builder(); } - public ModalityTokens withModality(@Nullable ResponseModality modality) { this.modality = modality; return this; } - /** * Number of tokens for the modality. */ @@ -90,7 +88,6 @@ public ModalityTokens withTokens(@Nullable Integer tokens) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -100,33 +97,29 @@ public boolean equals(java.lang.Object o) { return false; } ModalityTokens other = (ModalityTokens) o; - return - Utils.enhancedDeepEquals(this.modality, other.modality) && - Utils.enhancedDeepEquals(this.tokens, other.tokens); + return Utils.enhancedDeepEquals(this.modality, other.modality) + && Utils.enhancedDeepEquals(this.tokens, other.tokens); } - + @Override public int hashCode() { - return Utils.enhancedHash( - modality, tokens); + return Utils.enhancedHash(modality, tokens); } - + @Override public String toString() { - return Utils.toString(ModalityTokens.class, - "modality", modality, - "tokens", tokens); + return Utils.toString(ModalityTokens.class, "modality", modality, "tokens", tokens); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private ResponseModality modality; private Integer tokens; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder modality(@Nullable ResponseModality modality) { @@ -143,9 +136,7 @@ public Builder tokens(@Nullable Integer tokens) { } public ModalityTokens build() { - return new ModalityTokens( - modality, tokens); + return new ModalityTokens(modality, tokens); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Mode.java b/src/main/java/com/google/genai/gaos/models/interactions/Mode.java index 530efe95949..1fd046d888b 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Mode.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Mode.java @@ -36,7 +36,7 @@ */ /** * Mode - * + * *

The mode of the find session. */ public class Mode { @@ -59,12 +59,12 @@ private Mode(String value) { } /** - * Returns a Mode with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a Mode with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as Mode - */ + */ @JsonCreator public static Mode of(String value) { synchronized (Mode.class) { @@ -92,12 +92,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; Mode other = (Mode) obj; return Objects.equals(value, other.value); } @@ -127,12 +124,12 @@ private static final Map createEnumsMap() { map.put("verify", ModeEnum.VERIFY); return map; } - - + public enum ModeEnum { SCAN("scan"), - VERIFY("verify"),; + VERIFY("verify"), + ; private final String value; @@ -145,4 +142,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Model.java b/src/main/java/com/google/genai/gaos/models/interactions/Model.java index 082a624d073..59d92e8df52 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Model.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Model.java @@ -36,7 +36,7 @@ */ /** * Model - * + * *

The model that will complete your prompt.\n\nSee * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. */ @@ -60,6 +60,7 @@ public class Model { public static final Model GEMINI31_FLASH_IMAGE = new Model("gemini-3.1-flash-image"); public static final Model GEMINI35_FLASH = new Model("gemini-3.5-flash"); public static final Model GEMINI36_FLASH = new Model("gemini-3.6-flash"); + public static final Model GEMINI37_FLASH = new Model("gemini-3.7-flash"); public static final Model LYRIA3_CLIP_PREVIEW = new Model("lyria-3-clip-preview"); public static final Model LYRIA3_PRO_PREVIEW = new Model("lyria-3-pro-preview"); public static final Model GEMINI_ROBOTICS_ER16_PREVIEW = new Model("gemini-robotics-er-1.6-preview"); @@ -80,12 +81,12 @@ private Model(String value) { } /** - * Returns a Model with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a Model with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as Model - */ + */ @JsonCreator public static Model of(String value) { synchronized (Model.class) { @@ -113,12 +114,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; Model other = (Model) obj; return Objects.equals(value, other.value); } @@ -155,6 +153,7 @@ private static final Map createValuesMap() { map.put("gemini-3.1-flash-image", GEMINI31_FLASH_IMAGE); map.put("gemini-3.5-flash", GEMINI35_FLASH); map.put("gemini-3.6-flash", GEMINI36_FLASH); + map.put("gemini-3.7-flash", GEMINI37_FLASH); map.put("lyria-3-clip-preview", LYRIA3_CLIP_PREVIEW); map.put("lyria-3-pro-preview", LYRIA3_PRO_PREVIEW); map.put("gemini-robotics-er-1.6-preview", GEMINI_ROBOTICS_ER16_PREVIEW); @@ -182,14 +181,14 @@ private static final Map createEnumsMap() { map.put("gemini-3.1-flash-image", ModelEnum.GEMINI31_FLASH_IMAGE); map.put("gemini-3.5-flash", ModelEnum.GEMINI35_FLASH); map.put("gemini-3.6-flash", ModelEnum.GEMINI36_FLASH); + map.put("gemini-3.7-flash", ModelEnum.GEMINI37_FLASH); map.put("lyria-3-clip-preview", ModelEnum.LYRIA3_CLIP_PREVIEW); map.put("lyria-3-pro-preview", ModelEnum.LYRIA3_PRO_PREVIEW); map.put("gemini-robotics-er-1.6-preview", ModelEnum.GEMINI_ROBOTICS_ER16_PREVIEW); map.put("gemini-robotics-er-2-preview", ModelEnum.GEMINI_ROBOTICS_ER2_PREVIEW); return map; } - - + public enum ModelEnum { GEMINI25_FLASH("gemini-2.5-flash"), @@ -210,10 +209,12 @@ public enum ModelEnum { GEMINI31_FLASH_IMAGE("gemini-3.1-flash-image"), GEMINI35_FLASH("gemini-3.5-flash"), GEMINI36_FLASH("gemini-3.6-flash"), + GEMINI37_FLASH("gemini-3.7-flash"), LYRIA3_CLIP_PREVIEW("lyria-3-clip-preview"), LYRIA3_PRO_PREVIEW("lyria-3-pro-preview"), GEMINI_ROBOTICS_ER16_PREVIEW("gemini-robotics-er-1.6-preview"), - GEMINI_ROBOTICS_ER2_PREVIEW("gemini-robotics-er-2-preview"),; + GEMINI_ROBOTICS_ER2_PREVIEW("gemini-robotics-er-2-preview"), + ; private final String value; @@ -226,4 +227,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ModelOutputStep.java b/src/main/java/com/google/genai/gaos/models/interactions/ModelOutputStep.java index 97c023be21c..ecfefc1e15c 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ModelOutputStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ModelOutputStep.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * ModelOutputStep - * + * *

Output generated by the model. */ public class ModelOutputStep implements Step { @@ -48,7 +48,7 @@ public class ModelOutputStep implements Step { * different programming environments, including REST APIs and RPC APIs. It is * used by [gRPC](https://github.com/grpc). Each `Status` message contains * three pieces of data: error code, error message, and error details. - * + * *

You can find out more about this error model and how to work with it in the * [API Design Guide](https://cloud.google.com/apis/design/errors). */ @@ -56,19 +56,17 @@ public class ModelOutputStep implements Step { @JsonProperty("error") private Status error; - @JsonProperty("type") private String type; @JsonCreator public ModelOutputStep( - @JsonProperty("content") @Nullable List content, - @JsonProperty("error") @Nullable Status error) { + @JsonProperty("content") @Nullable List content, @JsonProperty("error") @Nullable Status error) { this.content = content; this.error = error; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public ModelOutputStep() { this(null, null); } @@ -82,7 +80,7 @@ public Optional> content() { * different programming environments, including REST APIs and RPC APIs. It is * used by [gRPC](https://github.com/grpc). Each `Status` message contains * three pieces of data: error code, error message, and error details. - * + * *

You can find out more about this error model and how to work with it in the * [API Design Guide](https://cloud.google.com/apis/design/errors). */ @@ -99,19 +97,17 @@ public static Builder builder() { return new Builder(); } - public ModelOutputStep withContent(@Nullable List content) { this.content = content; return this; } - /** * The `Status` type defines a logical error model that is suitable for * different programming environments, including REST APIs and RPC APIs. It is * used by [gRPC](https://github.com/grpc). Each `Status` message contains * three pieces of data: error code, error message, and error details. - * + * *

You can find out more about this error model and how to work with it in the * [API Design Guide](https://cloud.google.com/apis/design/errors). */ @@ -120,7 +116,6 @@ public ModelOutputStep withError(@Nullable Status error) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -130,35 +125,30 @@ public boolean equals(java.lang.Object o) { return false; } ModelOutputStep other = (ModelOutputStep) o; - return - Utils.enhancedDeepEquals(this.content, other.content) && - Utils.enhancedDeepEquals(this.error, other.error) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.content, other.content) + && Utils.enhancedDeepEquals(this.error, other.error) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - content, error, type); + return Utils.enhancedHash(content, error, type); } - + @Override public String toString() { - return Utils.toString(ModelOutputStep.class, - "content", content, - "error", error, - "type", type); + return Utils.toString(ModelOutputStep.class, "content", content, "error", error, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List content; private Status error; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder content(@Nullable List content) { @@ -171,7 +161,7 @@ public Builder content(@Nullable List content) { * different programming environments, including REST APIs and RPC APIs. It is * used by [gRPC](https://github.com/grpc). Each `Status` message contains * three pieces of data: error code, error message, and error details. - * + * *

You can find out more about this error model and how to work with it in the * [API Design Guide](https://cloud.google.com/apis/design/errors). */ @@ -181,15 +171,10 @@ public Builder error(@Nullable Status error) { } public ModelOutputStep build() { - return new ModelOutputStep( - content, error); + return new ModelOutputStep(content, error); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"model_output\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"model_output\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Network.java b/src/main/java/com/google/genai/gaos/models/interactions/Network.java index b6b9cb5bd5e..ff52e449c75 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Network.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Network.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -35,7 +35,7 @@ /** * Network - * + * *

Network configuration for the environment. */ @JsonDeserialize(using = Network._Deserializer.class) @@ -43,21 +43,22 @@ public class Network { @JsonValue private final TypedObject value; - + private Network(TypedObject value) { this.value = value; } public static Network of(EnvironmentNetworkEgressAllowlist value) { Utils.checkNotNull(value, "value"); - return new Network(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new Network( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static Network of(NetworkEnum value) { Utils.checkNotNull(value, "value"); - return new Network(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new Network(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code EnvironmentNetworkEgressAllowlist}, * otherwise returns an empty {@link Optional}. @@ -70,7 +71,7 @@ public Optional environmentNetworkEgressAllow } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code NetworkEnum}, * otherwise returns an empty {@link Optional}. @@ -83,19 +84,19 @@ public Optional networkEnum() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -107,27 +108,27 @@ public boolean equals(java.lang.Object o) { Network other = (Network) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(Network.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + Network.class, + false, + TypeReferenceWithShape.of( + new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(Network.class, - "value", value); + return Utils.toString(Network.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/NetworkEnum.java b/src/main/java/com/google/genai/gaos/models/interactions/NetworkEnum.java index 9f532846562..90e44bfffed 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/NetworkEnum.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/NetworkEnum.java @@ -53,12 +53,12 @@ private NetworkEnum(String value) { } /** - * Returns a NetworkEnum with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a NetworkEnum with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as NetworkEnum - */ + */ @JsonCreator public static NetworkEnum of(String value) { synchronized (NetworkEnum.class) { @@ -86,12 +86,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; NetworkEnum other = (NetworkEnum) obj; return Objects.equals(value, other.value); } @@ -119,11 +116,11 @@ private static final Map createEnumsMap() { map.put("disabled", NetworkEnumEnum.DISABLED); return map; } - - + public enum NetworkEnumEnum { - DISABLED("disabled"),; + DISABLED("disabled"), + ; private final String value; @@ -136,4 +133,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ParallelAISearchConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/ParallelAISearchConfig.java index 33a1e178717..ade947f840e 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ParallelAISearchConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ParallelAISearchConfig.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -33,7 +33,7 @@ /** * ParallelAISearchConfig - * + * *

Used to specify configuration for ParallelAISearch. */ public class ParallelAISearchConfig { @@ -58,7 +58,7 @@ public ParallelAISearchConfig( this.apiKey = apiKey; this.customConfig = customConfig; } - + public ParallelAISearchConfig() { this(null, null); } @@ -81,7 +81,6 @@ public static Builder builder() { return new Builder(); } - /** * Optional. The API key for ParallelAiSearch. */ @@ -90,7 +89,6 @@ public ParallelAISearchConfig withApiKey(@Nullable String apiKey) { return this; } - /** * Optional. Custom configs for ParallelAiSearch. */ @@ -99,7 +97,6 @@ public ParallelAISearchConfig withCustomConfig(@Nullable Map cus return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -109,33 +106,29 @@ public boolean equals(java.lang.Object o) { return false; } ParallelAISearchConfig other = (ParallelAISearchConfig) o; - return - Utils.enhancedDeepEquals(this.apiKey, other.apiKey) && - Utils.enhancedDeepEquals(this.customConfig, other.customConfig); + return Utils.enhancedDeepEquals(this.apiKey, other.apiKey) + && Utils.enhancedDeepEquals(this.customConfig, other.customConfig); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiKey, customConfig); + return Utils.enhancedHash(apiKey, customConfig); } - + @Override public String toString() { - return Utils.toString(ParallelAISearchConfig.class, - "apiKey", apiKey, - "customConfig", customConfig); + return Utils.toString(ParallelAISearchConfig.class, "apiKey", apiKey, "customConfig", customConfig); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiKey; private Map customConfig; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -155,9 +148,7 @@ public Builder customConfig(@Nullable Map customConfig) { } public ParallelAISearchConfig build() { - return new ParallelAISearchConfig( - apiKey, customConfig); + return new ParallelAISearchConfig(apiKey, customConfig); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/PlaceCitation.java b/src/main/java/com/google/genai/gaos/models/interactions/PlaceCitation.java index 2c3fdf52c1b..913dd2e0be4 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/PlaceCitation.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/PlaceCitation.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -35,7 +35,7 @@ /** * PlaceCitation - * + * *

A place citation annotation. */ public class PlaceCitation implements Annotation { @@ -70,14 +70,13 @@ public class PlaceCitation implements Annotation { /** * Start of segment of the response that is attributed to this source. - * + * *

Index indicates the start of the segment, measured in bytes. */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("start_index") private Integer startIndex; - @JsonProperty("type") private String type; @@ -104,10 +103,9 @@ public PlaceCitation( this.type = Builder._SINGLETON_VALUE_Type.value(); this.url = url; } - + public PlaceCitation() { - this(null, null, null, - null, null, null); + this(null, null, null, null, null, null); } /** @@ -141,7 +139,7 @@ public Optional> reviewSnippets() { /** * Start of segment of the response that is attributed to this source. - * + * *

Index indicates the start of the segment, measured in bytes. */ public Optional startIndex() { @@ -164,7 +162,6 @@ public static Builder builder() { return new Builder(); } - /** * End of the attributed segment, exclusive. */ @@ -173,7 +170,6 @@ public PlaceCitation withEndIndex(@Nullable Integer endIndex) { return this; } - /** * Title of the place. */ @@ -182,7 +178,6 @@ public PlaceCitation withName(@Nullable String name) { return this; } - /** * The ID of the place, in `places/{place_id}` format. */ @@ -191,7 +186,6 @@ public PlaceCitation withPlaceId(@Nullable String placeId) { return this; } - /** * Snippets of reviews that are used to generate answers about the * features of a given place in Google Maps. @@ -201,10 +195,9 @@ public PlaceCitation withReviewSnippets(@Nullable List reviewSnip return this; } - /** * Start of segment of the response that is attributed to this source. - * + * *

Index indicates the start of the segment, measured in bytes. */ public PlaceCitation withStartIndex(@Nullable Integer startIndex) { @@ -212,7 +205,6 @@ public PlaceCitation withStartIndex(@Nullable Integer startIndex) { return this; } - /** * URI reference of the place. */ @@ -221,7 +213,6 @@ public PlaceCitation withUrl(@Nullable String url) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -231,38 +222,42 @@ public boolean equals(java.lang.Object o) { return false; } PlaceCitation other = (PlaceCitation) o; - return - Utils.enhancedDeepEquals(this.endIndex, other.endIndex) && - Utils.enhancedDeepEquals(this.name, other.name) && - Utils.enhancedDeepEquals(this.placeId, other.placeId) && - Utils.enhancedDeepEquals(this.reviewSnippets, other.reviewSnippets) && - Utils.enhancedDeepEquals(this.startIndex, other.startIndex) && - Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.url, other.url); + return Utils.enhancedDeepEquals(this.endIndex, other.endIndex) + && Utils.enhancedDeepEquals(this.name, other.name) + && Utils.enhancedDeepEquals(this.placeId, other.placeId) + && Utils.enhancedDeepEquals(this.reviewSnippets, other.reviewSnippets) + && Utils.enhancedDeepEquals(this.startIndex, other.startIndex) + && Utils.enhancedDeepEquals(this.type, other.type) + && Utils.enhancedDeepEquals(this.url, other.url); } - + @Override public int hashCode() { - return Utils.enhancedHash( - endIndex, name, placeId, - reviewSnippets, startIndex, type, - url); + return Utils.enhancedHash(endIndex, name, placeId, reviewSnippets, startIndex, type, url); } - + @Override public String toString() { - return Utils.toString(PlaceCitation.class, - "endIndex", endIndex, - "name", name, - "placeId", placeId, - "reviewSnippets", reviewSnippets, - "startIndex", startIndex, - "type", type, - "url", url); + return Utils.toString( + PlaceCitation.class, + "endIndex", + endIndex, + "name", + name, + "placeId", + placeId, + "reviewSnippets", + reviewSnippets, + "startIndex", + startIndex, + "type", + type, + "url", + url); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Integer endIndex; @@ -277,7 +272,7 @@ public final static class Builder { private String url; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -315,7 +310,7 @@ public Builder reviewSnippets(@Nullable List reviewSnippets) { /** * Start of segment of the response that is attributed to this source. - * + * *

Index indicates the start of the segment, measured in bytes. */ public Builder startIndex(@Nullable Integer startIndex) { @@ -332,16 +327,10 @@ public Builder url(@Nullable String url) { } public PlaceCitation build() { - return new PlaceCitation( - endIndex, name, placeId, - reviewSnippets, startIndex, url); + return new PlaceCitation(endIndex, name, placeId, reviewSnippets, startIndex, url); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"place_citation\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"place_citation\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Processing.java b/src/main/java/com/google/genai/gaos/models/interactions/Processing.java new file mode 100644 index 00000000000..6ee32cc4147 --- /dev/null +++ b/src/main/java/com/google/genai/gaos/models/interactions/Processing.java @@ -0,0 +1,132 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.google.genai.gaos.models.interactions; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.genai.gaos.utils.OneOfDeserializer; +import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; +import com.google.genai.gaos.utils.Utils.JsonShape; +import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Optional; + +/** + * Processing + * + *

How the model processes this video for understanding. + */ +@JsonDeserialize(using = Processing._Deserializer.class) +public class Processing { + + @JsonValue + private final TypedObject value; + + private Processing(TypedObject value) { + this.value = value; + } + + public static Processing of(MediaProcessing value) { + Utils.checkNotNull(value, "value"); + return new Processing(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); + } + + public static Processing of(ProcessingEnum value) { + Utils.checkNotNull(value, "value"); + return new Processing(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); + } + + /** + * Returns an {@link Optional} containing the value if it is of type {@code MediaProcessing}, + * otherwise returns an empty {@link Optional}. + * + * @return an {@link Optional} containing the {@code MediaProcessing} value, or empty if not of this type + */ + public Optional mediaProcessing() { + if (value.value() instanceof MediaProcessing) { + return Optional.of((MediaProcessing) value.value()); + } + return Optional.empty(); + } + + /** + * Returns an {@link Optional} containing the value if it is of type {@code ProcessingEnum}, + * otherwise returns an empty {@link Optional}. + * + * @return an {@link Optional} containing the {@code ProcessingEnum} value, or empty if not of this type + */ + public Optional processingEnum() { + if (value.value() instanceof ProcessingEnum) { + return Optional.of((ProcessingEnum) value.value()); + } + return Optional.empty(); + } + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Processing other = (Processing) o; + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); + } + + @Override + public int hashCode() { + return Utils.enhancedHash(value.value()); + } + + @SuppressWarnings("serial") + public static final class _Deserializer extends OneOfDeserializer { + + public _Deserializer() { + super( + Processing.class, + false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + } + } + + @Override + public String toString() { + return Utils.toString(Processing.class, "value", value); + } +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ProcessingEnum.java b/src/main/java/com/google/genai/gaos/models/interactions/ProcessingEnum.java new file mode 100644 index 00000000000..e8b4952b96e --- /dev/null +++ b/src/main/java/com/google/genai/gaos/models/interactions/ProcessingEnum.java @@ -0,0 +1,139 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.google.genai.gaos.models.interactions; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.lang.Override; +import java.lang.String; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +/** + * Wrapper for an "open" enum that can handle unknown values from API responses + * without runtime errors. Instances are immutable singletons with reference equality. + * Use {@code asEnum()} for switch expressions. + */ +public class ProcessingEnum { + + public static final ProcessingEnum STATIC = new ProcessingEnum("static"); + public static final ProcessingEnum AGENTIC = new ProcessingEnum("agentic"); + + // This map will grow whenever a Color gets created with a new + // unrecognized value (a potential memory leak if the user is not + // careful). Keep this field lower case to avoid clashing with + // generated member names which will always be upper cased (Java + // convention) + private static final Map values = createValuesMap(); + private static final Map enums = createEnumsMap(); + + private final String value; + + private ProcessingEnum(String value) { + this.value = value; + } + + /** + * Returns a ProcessingEnum with the given value. For a specific value the + * returned object will always be a singleton so reference equality + * is satisfied when the values are the same. + * + * @param value value to be wrapped as ProcessingEnum + */ + @JsonCreator + public static ProcessingEnum of(String value) { + synchronized (ProcessingEnum.class) { + return values.computeIfAbsent(value, v -> new ProcessingEnum(v)); + } + } + + @JsonValue + public String value() { + return value; + } + + public Optional asEnum() { + return Optional.ofNullable(enums.getOrDefault(value, null)); + } + + public boolean isKnown() { + return asEnum().isPresent(); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + ProcessingEnum other = (ProcessingEnum) obj; + return Objects.equals(value, other.value); + } + + @Override + public String toString() { + return "ProcessingEnum [value=" + value + "]"; + } + + // return an array just like an enum + public static ProcessingEnum[] values() { + synchronized (ProcessingEnum.class) { + return values.values().toArray(new ProcessingEnum[] {}); + } + } + + private static final Map createValuesMap() { + Map map = new LinkedHashMap<>(); + map.put("static", STATIC); + map.put("agentic", AGENTIC); + return map; + } + + private static final Map createEnumsMap() { + Map map = new HashMap<>(); + map.put("static", ProcessingEnumEnum.STATIC); + map.put("agentic", ProcessingEnumEnum.AGENTIC); + return map; + } + + public enum ProcessingEnumEnum { + + STATIC("static"), + AGENTIC("agentic"), + ; + + private final String value; + + private ProcessingEnumEnum(String value) { + this.value = value; + } + + public String value() { + return value; + } + } +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/RagResource.java b/src/main/java/com/google/genai/gaos/models/interactions/RagResource.java index 502c45e4604..bda2ee6aa31 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/RagResource.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/RagResource.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * RagResource - * + * *

The definition of the Rag resource. */ public class RagResource { @@ -58,7 +58,7 @@ public RagResource( this.ragCorpus = ragCorpus; this.ragFileIds = ragFileIds; } - + public RagResource() { this(null, null); } @@ -82,7 +82,6 @@ public static Builder builder() { return new Builder(); } - /** * Optional. RagCorpora resource name. */ @@ -91,7 +90,6 @@ public RagResource withRagCorpus(@Nullable String ragCorpus) { return this; } - /** * Optional. rag_file_id. The files should be in the same rag_corpus set in * rag_corpus field. @@ -101,7 +99,6 @@ public RagResource withRagFileIds(@Nullable List ragFileIds) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -111,33 +108,29 @@ public boolean equals(java.lang.Object o) { return false; } RagResource other = (RagResource) o; - return - Utils.enhancedDeepEquals(this.ragCorpus, other.ragCorpus) && - Utils.enhancedDeepEquals(this.ragFileIds, other.ragFileIds); + return Utils.enhancedDeepEquals(this.ragCorpus, other.ragCorpus) + && Utils.enhancedDeepEquals(this.ragFileIds, other.ragFileIds); } - + @Override public int hashCode() { - return Utils.enhancedHash( - ragCorpus, ragFileIds); + return Utils.enhancedHash(ragCorpus, ragFileIds); } - + @Override public String toString() { - return Utils.toString(RagResource.class, - "ragCorpus", ragCorpus, - "ragFileIds", ragFileIds); + return Utils.toString(RagResource.class, "ragCorpus", ragCorpus, "ragFileIds", ragFileIds); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String ragCorpus; private List ragFileIds; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -158,9 +151,7 @@ public Builder ragFileIds(@Nullable List ragFileIds) { } public RagResource build() { - return new RagResource( - ragCorpus, ragFileIds); + return new RagResource(ragCorpus, ragFileIds); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/RagRetrievalConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/RagRetrievalConfig.java index ab4de40f770..32f4cedc143 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/RagRetrievalConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/RagRetrievalConfig.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * RagRetrievalConfig - * + * *

Specifies the context retrieval config. */ public class RagRetrievalConfig { @@ -75,10 +75,9 @@ public RagRetrievalConfig( this.ranking = ranking; this.topK = topK; } - + public RagRetrievalConfig() { - this(null, null, null, - null); + this(null, null, null, null); } /** @@ -113,7 +112,6 @@ public static Builder builder() { return new Builder(); } - /** * Config for filters. */ @@ -122,7 +120,6 @@ public RagRetrievalConfig withFilter(@Nullable Filter filter) { return this; } - /** * Config for Hybrid Search. */ @@ -131,7 +128,6 @@ public RagRetrievalConfig withHybridSearch(@Nullable HybridSearch hybridSearch) return this; } - /** * Config for Rank Service. */ @@ -140,7 +136,6 @@ public RagRetrievalConfig withRanking(@Nullable Ranking ranking) { return this; } - /** * Optional. The number of contexts to retrieve. */ @@ -149,7 +144,6 @@ public RagRetrievalConfig withTopK(@Nullable Integer topK) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -159,31 +153,33 @@ public boolean equals(java.lang.Object o) { return false; } RagRetrievalConfig other = (RagRetrievalConfig) o; - return - Utils.enhancedDeepEquals(this.filter, other.filter) && - Utils.enhancedDeepEquals(this.hybridSearch, other.hybridSearch) && - Utils.enhancedDeepEquals(this.ranking, other.ranking) && - Utils.enhancedDeepEquals(this.topK, other.topK); + return Utils.enhancedDeepEquals(this.filter, other.filter) + && Utils.enhancedDeepEquals(this.hybridSearch, other.hybridSearch) + && Utils.enhancedDeepEquals(this.ranking, other.ranking) + && Utils.enhancedDeepEquals(this.topK, other.topK); } - + @Override public int hashCode() { - return Utils.enhancedHash( - filter, hybridSearch, ranking, - topK); + return Utils.enhancedHash(filter, hybridSearch, ranking, topK); } - + @Override public String toString() { - return Utils.toString(RagRetrievalConfig.class, - "filter", filter, - "hybridSearch", hybridSearch, - "ranking", ranking, - "topK", topK); + return Utils.toString( + RagRetrievalConfig.class, + "filter", + filter, + "hybridSearch", + hybridSearch, + "ranking", + ranking, + "topK", + topK); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Filter filter; @@ -194,7 +190,7 @@ public final static class Builder { private Integer topK; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -230,10 +226,7 @@ public Builder topK(@Nullable Integer topK) { } public RagRetrievalConfig build() { - return new RagRetrievalConfig( - filter, hybridSearch, ranking, - topK); + return new RagRetrievalConfig(filter, hybridSearch, ranking, topK); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/RagStoreConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/RagStoreConfig.java index 31b39eabafc..daf682fc68d 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/RagStoreConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/RagStoreConfig.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -35,7 +35,7 @@ /** * RagStoreConfig - * + * *

Use to specify configuration for RAG Store. */ public class RagStoreConfig { @@ -55,7 +55,7 @@ public class RagStoreConfig { /** * Optional. Number of top k results to return from the selected corpora. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -65,7 +65,7 @@ public class RagStoreConfig { /** * Optional. Only return results with vector distance smaller than the threshold. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -84,10 +84,9 @@ public RagStoreConfig( this.similarityTopK = similarityTopK; this.vectorDistanceThreshold = vectorDistanceThreshold; } - + public RagStoreConfig() { - this(null, null, null, - null); + this(null, null, null, null); } /** @@ -106,7 +105,7 @@ public Optional ragRetrievalConfig() { /** * Optional. Number of top k results to return from the selected corpora. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -116,7 +115,7 @@ public Optional similarityTopK() { /** * Optional. Only return results with vector distance smaller than the threshold. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -128,7 +127,6 @@ public static Builder builder() { return new Builder(); } - /** * Optional. The representation of the rag source. */ @@ -137,7 +135,6 @@ public RagStoreConfig withRagResources(@Nullable List ragResources) return this; } - /** * Specifies the context retrieval config. */ @@ -146,10 +143,9 @@ public RagStoreConfig withRagRetrievalConfig(@Nullable RagRetrievalConfig ragRet return this; } - /** * Optional. Number of top k results to return from the selected corpora. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -158,10 +154,9 @@ public RagStoreConfig withSimilarityTopK(@Nullable Integer similarityTopK) { return this; } - /** * Optional. Only return results with vector distance smaller than the threshold. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -170,7 +165,6 @@ public RagStoreConfig withVectorDistanceThreshold(@Nullable Double vectorDistanc return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -180,31 +174,33 @@ public boolean equals(java.lang.Object o) { return false; } RagStoreConfig other = (RagStoreConfig) o; - return - Utils.enhancedDeepEquals(this.ragResources, other.ragResources) && - Utils.enhancedDeepEquals(this.ragRetrievalConfig, other.ragRetrievalConfig) && - Utils.enhancedDeepEquals(this.similarityTopK, other.similarityTopK) && - Utils.enhancedDeepEquals(this.vectorDistanceThreshold, other.vectorDistanceThreshold); + return Utils.enhancedDeepEquals(this.ragResources, other.ragResources) + && Utils.enhancedDeepEquals(this.ragRetrievalConfig, other.ragRetrievalConfig) + && Utils.enhancedDeepEquals(this.similarityTopK, other.similarityTopK) + && Utils.enhancedDeepEquals(this.vectorDistanceThreshold, other.vectorDistanceThreshold); } - + @Override public int hashCode() { - return Utils.enhancedHash( - ragResources, ragRetrievalConfig, similarityTopK, - vectorDistanceThreshold); + return Utils.enhancedHash(ragResources, ragRetrievalConfig, similarityTopK, vectorDistanceThreshold); } - + @Override public String toString() { - return Utils.toString(RagStoreConfig.class, - "ragResources", ragResources, - "ragRetrievalConfig", ragRetrievalConfig, - "similarityTopK", similarityTopK, - "vectorDistanceThreshold", vectorDistanceThreshold); + return Utils.toString( + RagStoreConfig.class, + "ragResources", + ragResources, + "ragRetrievalConfig", + ragRetrievalConfig, + "similarityTopK", + similarityTopK, + "vectorDistanceThreshold", + vectorDistanceThreshold); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List ragResources; @@ -217,7 +213,7 @@ public final static class Builder { private Double vectorDistanceThreshold; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -238,7 +234,7 @@ public Builder ragRetrievalConfig(@Nullable RagRetrievalConfig ragRetrievalConfi /** * Optional. Number of top k results to return from the selected corpora. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -249,7 +245,7 @@ public Builder similarityTopK(@Nullable Integer similarityTopK) { /** * Optional. Only return results with vector distance smaller than the threshold. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -259,10 +255,7 @@ public Builder vectorDistanceThreshold(@Nullable Double vectorDistanceThreshold) } public RagStoreConfig build() { - return new RagStoreConfig( - ragResources, ragRetrievalConfig, similarityTopK, - vectorDistanceThreshold); + return new RagStoreConfig(ragResources, ragRetrievalConfig, similarityTopK, vectorDistanceThreshold); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Ranking.java b/src/main/java/com/google/genai/gaos/models/interactions/Ranking.java index cc2042f6e8a..0adcf5a39e4 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Ranking.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Ranking.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -33,7 +33,7 @@ /** * Ranking - * + * *

Config for Rank Service. */ public class Ranking { @@ -44,17 +44,15 @@ public class Ranking { @JsonProperty("model_name") private String modelName; - @JsonProperty("ranking_config") private String rankingConfig; @JsonCreator - public Ranking( - @JsonProperty("model_name") @Nullable String modelName) { + public Ranking(@JsonProperty("model_name") @Nullable String modelName) { this.modelName = modelName; this.rankingConfig = Builder._SINGLETON_VALUE_RankingConfig.value(); } - + public Ranking() { this(null); } @@ -74,7 +72,6 @@ public static Builder builder() { return new Builder(); } - /** * Optional. The model name of the rank service. */ @@ -83,7 +80,6 @@ public Ranking withModelName(@Nullable String modelName) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -93,31 +89,27 @@ public boolean equals(java.lang.Object o) { return false; } Ranking other = (Ranking) o; - return - Utils.enhancedDeepEquals(this.modelName, other.modelName) && - Utils.enhancedDeepEquals(this.rankingConfig, other.rankingConfig); + return Utils.enhancedDeepEquals(this.modelName, other.modelName) + && Utils.enhancedDeepEquals(this.rankingConfig, other.rankingConfig); } - + @Override public int hashCode() { - return Utils.enhancedHash( - modelName, rankingConfig); + return Utils.enhancedHash(modelName, rankingConfig); } - + @Override public String toString() { - return Utils.toString(Ranking.class, - "modelName", modelName, - "rankingConfig", rankingConfig); + return Utils.toString(Ranking.class, "modelName", modelName, "rankingConfig", rankingConfig); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String modelName; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -129,15 +121,10 @@ public Builder modelName(@Nullable String modelName) { } public Ranking build() { - return new Ranking( - modelName); + return new Ranking(modelName); } - private static final LazySingletonValue _SINGLETON_VALUE_RankingConfig = - new LazySingletonValue<>( - "ranking_config", - "\"rank_service\"", - new TypeReference() {}); + new LazySingletonValue<>("ranking_config", "\"rank_service\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Resolution.java b/src/main/java/com/google/genai/gaos/models/interactions/Resolution.java new file mode 100644 index 00000000000..d7bba632a24 --- /dev/null +++ b/src/main/java/com/google/genai/gaos/models/interactions/Resolution.java @@ -0,0 +1,152 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.google.genai.gaos.models.interactions; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.lang.Override; +import java.lang.String; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +/** + * Wrapper for an "open" enum that can handle unknown values from API responses + * without runtime errors. Instances are immutable singletons with reference equality. + * Use {@code asEnum()} for switch expressions. + */ +/** + * Resolution + * + *

The video output resolution. Defaults to 720p. + */ +public class Resolution { + + public static final Resolution THREE_HUNDRED_AND_SIXTYP = new Resolution("360p"); + public static final Resolution SEVEN_HUNDRED_AND_TWENTYP = new Resolution("720p"); + public static final Resolution ONE_THOUSAND_AND_EIGHTYP = new Resolution("1080p"); + public static final Resolution FOURK = new Resolution("4k"); + + // This map will grow whenever a Color gets created with a new + // unrecognized value (a potential memory leak if the user is not + // careful). Keep this field lower case to avoid clashing with + // generated member names which will always be upper cased (Java + // convention) + private static final Map values = createValuesMap(); + private static final Map enums = createEnumsMap(); + + private final String value; + + private Resolution(String value) { + this.value = value; + } + + /** + * Returns a Resolution with the given value. For a specific value the + * returned object will always be a singleton so reference equality + * is satisfied when the values are the same. + * + * @param value value to be wrapped as Resolution + */ + @JsonCreator + public static Resolution of(String value) { + synchronized (Resolution.class) { + return values.computeIfAbsent(value, v -> new Resolution(v)); + } + } + + @JsonValue + public String value() { + return value; + } + + public Optional asEnum() { + return Optional.ofNullable(enums.getOrDefault(value, null)); + } + + public boolean isKnown() { + return asEnum().isPresent(); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + Resolution other = (Resolution) obj; + return Objects.equals(value, other.value); + } + + @Override + public String toString() { + return "Resolution [value=" + value + "]"; + } + + // return an array just like an enum + public static Resolution[] values() { + synchronized (Resolution.class) { + return values.values().toArray(new Resolution[] {}); + } + } + + private static final Map createValuesMap() { + Map map = new LinkedHashMap<>(); + map.put("360p", THREE_HUNDRED_AND_SIXTYP); + map.put("720p", SEVEN_HUNDRED_AND_TWENTYP); + map.put("1080p", ONE_THOUSAND_AND_EIGHTYP); + map.put("4k", FOURK); + return map; + } + + private static final Map createEnumsMap() { + Map map = new HashMap<>(); + map.put("360p", ResolutionEnum.THREE_HUNDRED_AND_SIXTYP); + map.put("720p", ResolutionEnum.SEVEN_HUNDRED_AND_TWENTYP); + map.put("1080p", ResolutionEnum.ONE_THOUSAND_AND_EIGHTYP); + map.put("4k", ResolutionEnum.FOURK); + return map; + } + + public enum ResolutionEnum { + + THREE_HUNDRED_AND_SIXTYP("360p"), + SEVEN_HUNDRED_AND_TWENTYP("720p"), + ONE_THOUSAND_AND_EIGHTYP("1080p"), + FOURK("4k"), + ; + + private final String value; + + private ResolutionEnum(String value) { + this.value = value; + } + + public String value() { + return value; + } + } +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ResponseFormat.java b/src/main/java/com/google/genai/gaos/models/interactions/ResponseFormat.java index c0d9f2ae4a6..5acbc7071f3 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ResponseFormat.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ResponseFormat.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Object; import java.lang.Override; import java.lang.String; @@ -40,36 +40,36 @@ public class ResponseFormat { @JsonValue private final TypedObject value; - + private ResponseFormat(TypedObject value) { this.value = value; } public static ResponseFormat of(AudioResponseFormat value) { Utils.checkNotNull(value, "value"); - return new ResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new ResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static ResponseFormat of(ImageResponseFormat value) { Utils.checkNotNull(value, "value"); - return new ResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new ResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static ResponseFormat of(TextResponseFormat value) { Utils.checkNotNull(value, "value"); - return new ResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new ResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static ResponseFormat of(VideoResponseFormat value) { Utils.checkNotNull(value, "value"); - return new ResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new ResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static ResponseFormat of(Map value) { Utils.checkNotNull(value, "value"); - return new ResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new ResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code AudioResponseFormat}, * otherwise returns an empty {@link Optional}. @@ -82,7 +82,7 @@ public Optional audioResponseFormat() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code ImageResponseFormat}, * otherwise returns an empty {@link Optional}. @@ -95,7 +95,7 @@ public Optional imageResponseFormat() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code TextResponseFormat}, * otherwise returns an empty {@link Optional}. @@ -108,7 +108,7 @@ public Optional textResponseFormat() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code VideoResponseFormat}, * otherwise returns an empty {@link Optional}. @@ -121,7 +121,7 @@ public Optional videoResponseFormat() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code Map}, * otherwise returns an empty {@link Optional}. @@ -135,19 +135,19 @@ public Optional> mapOfObject() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -159,30 +159,29 @@ public boolean equals(java.lang.Object o) { ResponseFormat other = (ResponseFormat) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(ResponseFormat.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT)); + super( + ResponseFormat.class, + false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(ResponseFormat.class, - "value", value); + return Utils.toString(ResponseFormat.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ResponseModality.java b/src/main/java/com/google/genai/gaos/models/interactions/ResponseModality.java index 6a2e8004583..8bb6aa9f6c9 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ResponseModality.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ResponseModality.java @@ -57,12 +57,12 @@ private ResponseModality(String value) { } /** - * Returns a ResponseModality with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a ResponseModality with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as ResponseModality - */ + */ @JsonCreator public static ResponseModality of(String value) { synchronized (ResponseModality.class) { @@ -90,12 +90,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; ResponseModality other = (ResponseModality) obj; return Objects.equals(value, other.value); } @@ -131,15 +128,15 @@ private static final Map createEnumsMap() { map.put("document", ResponseModalityEnum.DOCUMENT); return map; } - - + public enum ResponseModalityEnum { TEXT("text"), IMAGE("image"), AUDIO("audio"), VIDEO("video"), - DOCUMENT("document"),; + DOCUMENT("document"), + ; private final String value; @@ -152,4 +149,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Retrieval.java b/src/main/java/com/google/genai/gaos/models/interactions/Retrieval.java index 22d426e91a7..eca202f27aa 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Retrieval.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Retrieval.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * Retrieval - * + * *

A tool that can be used by the model to retrieve files. */ public class Retrieval implements Tool { @@ -66,7 +66,6 @@ public class Retrieval implements Tool { @JsonProperty("retrieval_types") private List retrievalTypes; - @JsonProperty("type") private String type; @@ -91,10 +90,9 @@ public Retrieval( this.type = Builder._SINGLETON_VALUE_Type.value(); this.vertexAiSearchConfig = vertexAiSearchConfig; } - + public Retrieval() { - this(null, null, null, - null, null); + this(null, null, null, null, null); } /** @@ -141,7 +139,6 @@ public static Builder builder() { return new Builder(); } - /** * Used to specify configuration for ExaAISearch. */ @@ -150,7 +147,6 @@ public Retrieval withExaAiSearchConfig(@Nullable ExaAISearchConfig exaAiSearchCo return this; } - /** * Used to specify configuration for ParallelAISearch. */ @@ -159,7 +155,6 @@ public Retrieval withParallelAiSearchConfig(@Nullable ParallelAISearchConfig par return this; } - /** * Use to specify configuration for RAG Store. */ @@ -168,7 +163,6 @@ public Retrieval withRagStoreConfig(@Nullable RagStoreConfig ragStoreConfig) { return this; } - /** * The types of file retrieval to enable. */ @@ -177,7 +171,6 @@ public Retrieval withRetrievalTypes(@Nullable List retri return this; } - /** * Used to specify configuration for VertexAISearch. */ @@ -186,7 +179,6 @@ public Retrieval withVertexAiSearchConfig(@Nullable VertexAISearchConfig vertexA return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -196,35 +188,40 @@ public boolean equals(java.lang.Object o) { return false; } Retrieval other = (Retrieval) o; - return - Utils.enhancedDeepEquals(this.exaAiSearchConfig, other.exaAiSearchConfig) && - Utils.enhancedDeepEquals(this.parallelAiSearchConfig, other.parallelAiSearchConfig) && - Utils.enhancedDeepEquals(this.ragStoreConfig, other.ragStoreConfig) && - Utils.enhancedDeepEquals(this.retrievalTypes, other.retrievalTypes) && - Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.vertexAiSearchConfig, other.vertexAiSearchConfig); + return Utils.enhancedDeepEquals(this.exaAiSearchConfig, other.exaAiSearchConfig) + && Utils.enhancedDeepEquals(this.parallelAiSearchConfig, other.parallelAiSearchConfig) + && Utils.enhancedDeepEquals(this.ragStoreConfig, other.ragStoreConfig) + && Utils.enhancedDeepEquals(this.retrievalTypes, other.retrievalTypes) + && Utils.enhancedDeepEquals(this.type, other.type) + && Utils.enhancedDeepEquals(this.vertexAiSearchConfig, other.vertexAiSearchConfig); } - + @Override public int hashCode() { return Utils.enhancedHash( - exaAiSearchConfig, parallelAiSearchConfig, ragStoreConfig, - retrievalTypes, type, vertexAiSearchConfig); + exaAiSearchConfig, parallelAiSearchConfig, ragStoreConfig, retrievalTypes, type, vertexAiSearchConfig); } - + @Override public String toString() { - return Utils.toString(Retrieval.class, - "exaAiSearchConfig", exaAiSearchConfig, - "parallelAiSearchConfig", parallelAiSearchConfig, - "ragStoreConfig", ragStoreConfig, - "retrievalTypes", retrievalTypes, - "type", type, - "vertexAiSearchConfig", vertexAiSearchConfig); + return Utils.toString( + Retrieval.class, + "exaAiSearchConfig", + exaAiSearchConfig, + "parallelAiSearchConfig", + parallelAiSearchConfig, + "ragStoreConfig", + ragStoreConfig, + "retrievalTypes", + retrievalTypes, + "type", + type, + "vertexAiSearchConfig", + vertexAiSearchConfig); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private ExaAISearchConfig exaAiSearchConfig; @@ -237,7 +234,7 @@ public final static class Builder { private VertexAISearchConfig vertexAiSearchConfig; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -282,15 +279,10 @@ public Builder vertexAiSearchConfig(@Nullable VertexAISearchConfig vertexAiSearc public Retrieval build() { return new Retrieval( - exaAiSearchConfig, parallelAiSearchConfig, ragStoreConfig, - retrievalTypes, vertexAiSearchConfig); + exaAiSearchConfig, parallelAiSearchConfig, ragStoreConfig, retrievalTypes, vertexAiSearchConfig); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"retrieval\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"retrieval\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/RetrievalCallArguments.java b/src/main/java/com/google/genai/gaos/models/interactions/RetrievalCallArguments.java index 6ac3a5ce41f..b8e577fca75 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/RetrievalCallArguments.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/RetrievalCallArguments.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * RetrievalCallArguments - * + * *

The arguments to pass to Retrieval tools. */ public class RetrievalCallArguments { @@ -44,11 +44,10 @@ public class RetrievalCallArguments { private List queries; @JsonCreator - public RetrievalCallArguments( - @JsonProperty("queries") @Nullable List queries) { + public RetrievalCallArguments(@JsonProperty("queries") @Nullable List queries) { this.queries = queries; } - + public RetrievalCallArguments() { this(null); } @@ -64,7 +63,6 @@ public static Builder builder() { return new Builder(); } - /** * Queries for Retrieval information. */ @@ -73,7 +71,6 @@ public RetrievalCallArguments withQueries(@Nullable List queries) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -83,29 +80,26 @@ public boolean equals(java.lang.Object o) { return false; } RetrievalCallArguments other = (RetrievalCallArguments) o; - return - Utils.enhancedDeepEquals(this.queries, other.queries); + return Utils.enhancedDeepEquals(this.queries, other.queries); } - + @Override public int hashCode() { - return Utils.enhancedHash( - queries); + return Utils.enhancedHash(queries); } - + @Override public String toString() { - return Utils.toString(RetrievalCallArguments.class, - "queries", queries); + return Utils.toString(RetrievalCallArguments.class, "queries", queries); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List queries; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -117,9 +111,7 @@ public Builder queries(@Nullable List queries) { } public RetrievalCallArguments build() { - return new RetrievalCallArguments( - queries); + return new RetrievalCallArguments(queries); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/RetrievalCallDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/RetrievalCallDelta.java index 2e64c458b54..ff6dd3cd0da 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/RetrievalCallDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/RetrievalCallDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * RetrievalCallDelta - * + * *

Used by Vertex Retrieval tools such as Parallel AI, Exa AI, Vertex AI Search, * etc. RetrievalType decides which tool is used. */ @@ -59,7 +59,6 @@ public class RetrievalCallDelta implements StepDeltaData { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -69,14 +68,13 @@ public RetrievalCallDelta( @JsonProperty("retrieval_type") @Nullable RetrievalCallDeltaRetrievalType retrievalType, @JsonProperty("signature") @Nullable String signature) { this.arguments = Optional.ofNullable(arguments) - .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); this.retrievalType = retrievalType; this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public RetrievalCallDelta( - @Nonnull RetrievalCallArguments arguments) { + + public RetrievalCallDelta(@Nonnull RetrievalCallArguments arguments) { this(arguments, null, null); } @@ -110,7 +108,6 @@ public static Builder builder() { return new Builder(); } - /** * The arguments to pass to Retrieval tools. */ @@ -119,7 +116,6 @@ public RetrievalCallDelta withArguments(@Nonnull RetrievalCallArguments argument return this; } - /** * The type of retrieval tools. */ @@ -128,7 +124,6 @@ public RetrievalCallDelta withRetrievalType(@Nullable RetrievalCallDeltaRetrieva return this; } - /** * A signature hash for backend validation. */ @@ -137,7 +132,6 @@ public RetrievalCallDelta withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -147,31 +141,33 @@ public boolean equals(java.lang.Object o) { return false; } RetrievalCallDelta other = (RetrievalCallDelta) o; - return - Utils.enhancedDeepEquals(this.arguments, other.arguments) && - Utils.enhancedDeepEquals(this.retrievalType, other.retrievalType) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.arguments, other.arguments) + && Utils.enhancedDeepEquals(this.retrievalType, other.retrievalType) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - arguments, retrievalType, signature, - type); + return Utils.enhancedHash(arguments, retrievalType, signature, type); } - + @Override public String toString() { - return Utils.toString(RetrievalCallDelta.class, - "arguments", arguments, - "retrievalType", retrievalType, - "signature", signature, - "type", type); + return Utils.toString( + RetrievalCallDelta.class, + "arguments", + arguments, + "retrievalType", + retrievalType, + "signature", + signature, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private RetrievalCallArguments arguments; @@ -180,7 +176,7 @@ public final static class Builder { private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -208,15 +204,10 @@ public Builder signature(@Nullable String signature) { } public RetrievalCallDelta build() { - return new RetrievalCallDelta( - arguments, retrievalType, signature); + return new RetrievalCallDelta(arguments, retrievalType, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"retrieval_call\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"retrieval_call\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/RetrievalCallDeltaRetrievalType.java b/src/main/java/com/google/genai/gaos/models/interactions/RetrievalCallDeltaRetrievalType.java index b3a8304ea21..a1f4133fda8 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/RetrievalCallDeltaRetrievalType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/RetrievalCallDeltaRetrievalType.java @@ -36,15 +36,18 @@ */ /** * RetrievalCallDeltaRetrievalType - * + * *

The type of retrieval tools. */ public class RetrievalCallDeltaRetrievalType { - public static final RetrievalCallDeltaRetrievalType VERTEX_AI_SEARCH = new RetrievalCallDeltaRetrievalType("vertex_ai_search"); + public static final RetrievalCallDeltaRetrievalType VERTEX_AI_SEARCH = + new RetrievalCallDeltaRetrievalType("vertex_ai_search"); public static final RetrievalCallDeltaRetrievalType RAG_STORE = new RetrievalCallDeltaRetrievalType("rag_store"); - public static final RetrievalCallDeltaRetrievalType EXA_AI_SEARCH = new RetrievalCallDeltaRetrievalType("exa_ai_search"); - public static final RetrievalCallDeltaRetrievalType PARALLEL_AI_SEARCH = new RetrievalCallDeltaRetrievalType("parallel_ai_search"); + public static final RetrievalCallDeltaRetrievalType EXA_AI_SEARCH = + new RetrievalCallDeltaRetrievalType("exa_ai_search"); + public static final RetrievalCallDeltaRetrievalType PARALLEL_AI_SEARCH = + new RetrievalCallDeltaRetrievalType("parallel_ai_search"); // This map will grow whenever a Color gets created with a new // unrecognized value (a potential memory leak if the user is not @@ -61,12 +64,12 @@ private RetrievalCallDeltaRetrievalType(String value) { } /** - * Returns a RetrievalCallDeltaRetrievalType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a RetrievalCallDeltaRetrievalType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as RetrievalCallDeltaRetrievalType - */ + */ @JsonCreator public static RetrievalCallDeltaRetrievalType of(String value) { synchronized (RetrievalCallDeltaRetrievalType.class) { @@ -94,12 +97,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; RetrievalCallDeltaRetrievalType other = (RetrievalCallDeltaRetrievalType) obj; return Objects.equals(value, other.value); } @@ -133,14 +133,14 @@ private static final Map createEnum map.put("parallel_ai_search", RetrievalCallDeltaRetrievalTypeEnum.PARALLEL_AI_SEARCH); return map; } - - + public enum RetrievalCallDeltaRetrievalTypeEnum { VERTEX_AI_SEARCH("vertex_ai_search"), RAG_STORE("rag_store"), EXA_AI_SEARCH("exa_ai_search"), - PARALLEL_AI_SEARCH("parallel_ai_search"),; + PARALLEL_AI_SEARCH("parallel_ai_search"), + ; private final String value; @@ -153,4 +153,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/RetrievalResultDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/RetrievalResultDelta.java index e47eec0dec6..4c43b4378a3 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/RetrievalResultDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/RetrievalResultDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * RetrievalResultDelta - * + * *

Used by Vertex Retrieval tools such as Parallel AI, Exa AI, Vertex AI Search, * etc. * ToolResultDelta.type @@ -54,7 +54,6 @@ public class RetrievalResultDelta implements StepDeltaData { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -66,7 +65,7 @@ public RetrievalResultDelta( this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public RetrievalResultDelta() { this(null, null); } @@ -94,7 +93,6 @@ public static Builder builder() { return new Builder(); } - /** * Whether the retrieval resulted in an error. */ @@ -103,7 +101,6 @@ public RetrievalResultDelta withIsError(@Nullable Boolean isError) { return this; } - /** * A signature hash for backend validation. */ @@ -112,7 +109,6 @@ public RetrievalResultDelta withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -122,35 +118,30 @@ public boolean equals(java.lang.Object o) { return false; } RetrievalResultDelta other = (RetrievalResultDelta) o; - return - Utils.enhancedDeepEquals(this.isError, other.isError) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.isError, other.isError) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - isError, signature, type); + return Utils.enhancedHash(isError, signature, type); } - + @Override public String toString() { - return Utils.toString(RetrievalResultDelta.class, - "isError", isError, - "signature", signature, - "type", type); + return Utils.toString(RetrievalResultDelta.class, "isError", isError, "signature", signature, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Boolean isError; private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -170,15 +161,10 @@ public Builder signature(@Nullable String signature) { } public RetrievalResultDelta build() { - return new RetrievalResultDelta( - isError, signature); + return new RetrievalResultDelta(isError, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"retrieval_result\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"retrieval_result\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/RetrievalRetrievalType.java b/src/main/java/com/google/genai/gaos/models/interactions/RetrievalRetrievalType.java index 352ef5a3aa5..276e2ab9d62 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/RetrievalRetrievalType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/RetrievalRetrievalType.java @@ -56,12 +56,12 @@ private RetrievalRetrievalType(String value) { } /** - * Returns a RetrievalRetrievalType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a RetrievalRetrievalType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as RetrievalRetrievalType - */ + */ @JsonCreator public static RetrievalRetrievalType of(String value) { synchronized (RetrievalRetrievalType.class) { @@ -89,12 +89,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; RetrievalRetrievalType other = (RetrievalRetrievalType) obj; return Objects.equals(value, other.value); } @@ -128,14 +125,14 @@ private static final Map createEnumsMap() { map.put("parallel_ai_search", RetrievalRetrievalTypeEnum.PARALLEL_AI_SEARCH); return map; } - - + public enum RetrievalRetrievalTypeEnum { VERTEX_AI_SEARCH("vertex_ai_search"), RAG_STORE("rag_store"), EXA_AI_SEARCH("exa_ai_search"), - PARALLEL_AI_SEARCH("parallel_ai_search"),; + PARALLEL_AI_SEARCH("parallel_ai_search"), + ; private final String value; @@ -148,4 +145,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ReviewSnippet.java b/src/main/java/com/google/genai/gaos/models/interactions/ReviewSnippet.java index a86d35ae600..9cf902dee27 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ReviewSnippet.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ReviewSnippet.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -31,7 +31,7 @@ /** * ReviewSnippet - * + * *

Encapsulates a snippet of a user review that answers a question about * the features of a specific place in Google Maps. */ @@ -66,7 +66,7 @@ public ReviewSnippet( this.title = title; this.url = url; } - + public ReviewSnippet() { this(null, null, null); } @@ -96,7 +96,6 @@ public static Builder builder() { return new Builder(); } - /** * The ID of the review snippet. */ @@ -105,7 +104,6 @@ public ReviewSnippet withReviewId(@Nullable String reviewId) { return this; } - /** * Title of the review. */ @@ -114,7 +112,6 @@ public ReviewSnippet withTitle(@Nullable String title) { return this; } - /** * A link that corresponds to the user review on Google Maps. */ @@ -123,7 +120,6 @@ public ReviewSnippet withUrl(@Nullable String url) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -133,28 +129,23 @@ public boolean equals(java.lang.Object o) { return false; } ReviewSnippet other = (ReviewSnippet) o; - return - Utils.enhancedDeepEquals(this.reviewId, other.reviewId) && - Utils.enhancedDeepEquals(this.title, other.title) && - Utils.enhancedDeepEquals(this.url, other.url); + return Utils.enhancedDeepEquals(this.reviewId, other.reviewId) + && Utils.enhancedDeepEquals(this.title, other.title) + && Utils.enhancedDeepEquals(this.url, other.url); } - + @Override public int hashCode() { - return Utils.enhancedHash( - reviewId, title, url); + return Utils.enhancedHash(reviewId, title, url); } - + @Override public String toString() { - return Utils.toString(ReviewSnippet.class, - "reviewId", reviewId, - "title", title, - "url", url); + return Utils.toString(ReviewSnippet.class, "reviewId", reviewId, "title", title, "url", url); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String reviewId; @@ -163,7 +154,7 @@ public final static class Builder { private String url; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -191,9 +182,7 @@ public Builder url(@Nullable String url) { } public ReviewSnippet build() { - return new ReviewSnippet( - reviewId, title, url); + return new ReviewSnippet(reviewId, title, url); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/SafetySetting.java b/src/main/java/com/google/genai/gaos/models/interactions/SafetySetting.java index 469ee693ff0..59c0c4ae441 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/SafetySetting.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/SafetySetting.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nonnull; @@ -32,9 +32,9 @@ /** * SafetySetting - * + * *

A safety setting that affects the safety-blocking behavior. - * + * *

A SafetySetting consists of a * harm category and a * threshold for that @@ -56,7 +56,6 @@ public class SafetySetting { @JsonProperty("threshold") private Threshold threshold; - @JsonProperty("type") private HarmCategory type; @@ -67,14 +66,11 @@ public SafetySetting( @JsonProperty("type") @Nonnull HarmCategory type) { this.method = method; this.threshold = Optional.ofNullable(threshold) - .orElseThrow(() -> new IllegalArgumentException("threshold cannot be null")); - this.type = Optional.ofNullable(type) - .orElseThrow(() -> new IllegalArgumentException("type cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("threshold cannot be null")); + this.type = Optional.ofNullable(type).orElseThrow(() -> new IllegalArgumentException("type cannot be null")); } - - public SafetySetting( - @Nonnull Threshold threshold, - @Nonnull HarmCategory type) { + + public SafetySetting(@Nonnull Threshold threshold, @Nonnull HarmCategory type) { this(null, threshold, type); } @@ -102,7 +98,6 @@ public static Builder builder() { return new Builder(); } - /** * Optional. The method for blocking content. If not specified, the default * behavior is to use the probability score. @@ -112,7 +107,6 @@ public SafetySetting withMethod(@Nullable Method method) { return this; } - /** * Required. The threshold for blocking content. If the harm probability * exceeds this threshold, the content will be blocked. @@ -122,13 +116,11 @@ public SafetySetting withThreshold(@Nonnull Threshold threshold) { return this; } - public SafetySetting withType(@Nonnull HarmCategory type) { this.type = Utils.checkNotNull(type, "type"); return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -138,28 +130,23 @@ public boolean equals(java.lang.Object o) { return false; } SafetySetting other = (SafetySetting) o; - return - Utils.enhancedDeepEquals(this.method, other.method) && - Utils.enhancedDeepEquals(this.threshold, other.threshold) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.method, other.method) + && Utils.enhancedDeepEquals(this.threshold, other.threshold) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - method, threshold, type); + return Utils.enhancedHash(method, threshold, type); } - + @Override public String toString() { - return Utils.toString(SafetySetting.class, - "method", method, - "threshold", threshold, - "type", type); + return Utils.toString(SafetySetting.class, "method", method, "threshold", threshold, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Method method; @@ -168,7 +155,7 @@ public final static class Builder { private HarmCategory type; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -195,9 +182,7 @@ public Builder type(@Nonnull HarmCategory type) { } public SafetySetting build() { - return new SafetySetting( - method, threshold, type); + return new SafetySetting(method, threshold, type); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ServiceTier.java b/src/main/java/com/google/genai/gaos/models/interactions/ServiceTier.java index 50cc357eca6..fd2e6cc85f4 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ServiceTier.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ServiceTier.java @@ -56,12 +56,12 @@ private ServiceTier(String value) { } /** - * Returns a ServiceTier with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a ServiceTier with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as ServiceTier - */ + */ @JsonCreator public static ServiceTier of(String value) { synchronized (ServiceTier.class) { @@ -89,12 +89,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; ServiceTier other = (ServiceTier) obj; return Objects.equals(value, other.value); } @@ -128,14 +125,14 @@ private static final Map createEnumsMap() { map.put("deferred", ServiceTierEnum.DEFERRED); return map; } - - + public enum ServiceTierEnum { FLEX("flex"), STANDARD("standard"), PRIORITY("priority"), - DEFERRED("deferred"),; + DEFERRED("deferred"), + ; private final String value; @@ -148,4 +145,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/SessionConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/SessionConfig.java index a008b2aef3c..74819583c7c 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/SessionConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/SessionConfig.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * SessionConfig - * + * *

The configuration of CodeMender sessions. */ public class SessionConfig { @@ -45,11 +45,10 @@ public class SessionConfig { private Integer maxRounds; @JsonCreator - public SessionConfig( - @JsonProperty("max_rounds") @Nullable Integer maxRounds) { + public SessionConfig(@JsonProperty("max_rounds") @Nullable Integer maxRounds) { this.maxRounds = maxRounds; } - + public SessionConfig() { this(null); } @@ -66,7 +65,6 @@ public static Builder builder() { return new Builder(); } - /** * The maximum number of interaction rounds the agent is allowed to perform * before reaching a timeout. @@ -76,7 +74,6 @@ public SessionConfig withMaxRounds(@Nullable Integer maxRounds) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -86,29 +83,26 @@ public boolean equals(java.lang.Object o) { return false; } SessionConfig other = (SessionConfig) o; - return - Utils.enhancedDeepEquals(this.maxRounds, other.maxRounds); + return Utils.enhancedDeepEquals(this.maxRounds, other.maxRounds); } - + @Override public int hashCode() { - return Utils.enhancedHash( - maxRounds); + return Utils.enhancedHash(maxRounds); } - + @Override public String toString() { - return Utils.toString(SessionConfig.class, - "maxRounds", maxRounds); + return Utils.toString(SessionConfig.class, "maxRounds", maxRounds); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Integer maxRounds; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -121,9 +115,7 @@ public Builder maxRounds(@Nullable Integer maxRounds) { } public SessionConfig build() { - return new SessionConfig( - maxRounds); + return new SessionConfig(maxRounds); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Source.java b/src/main/java/com/google/genai/gaos/models/interactions/Source.java index 57f44d8deca..b99fe8b992a 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Source.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Source.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -31,7 +31,7 @@ /** * Source - * + * *

A source to be mounted into the environment. */ public class Source { @@ -51,7 +51,7 @@ public class Source { /** * The source of the environment. - * For GCS, this is the GCS path. + * For Cloud Storage, this is the Cloud Storage path. * For GitHub, this is the GitHub path. */ @JsonInclude(Include.NON_ABSENT) @@ -65,7 +65,6 @@ public class Source { @JsonProperty("target") private String target; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("type") private SourceType type; @@ -83,10 +82,9 @@ public Source( this.target = target; this.type = type; } - + public Source() { - this(null, null, null, - null, null); + this(null, null, null, null, null); } /** @@ -105,7 +103,7 @@ public Optional encoding() { /** * The source of the environment. - * For GCS, this is the GCS path. + * For Cloud Storage, this is the Cloud Storage path. * For GitHub, this is the GitHub path. */ public Optional source() { @@ -127,7 +125,6 @@ public static Builder builder() { return new Builder(); } - /** * The inline content if `type` is `INLINE`. */ @@ -136,7 +133,6 @@ public Source withContent(@Nullable String content) { return this; } - /** * Optional encoding for inline content (e.g. `base64`). */ @@ -145,10 +141,9 @@ public Source withEncoding(@Nullable String encoding) { return this; } - /** * The source of the environment. - * For GCS, this is the GCS path. + * For Cloud Storage, this is the Cloud Storage path. * For GitHub, this is the GitHub path. */ public Source withSource(@Nullable String source) { @@ -156,7 +151,6 @@ public Source withSource(@Nullable String source) { return this; } - /** * Where the source should appear in the environment. */ @@ -165,13 +159,11 @@ public Source withTarget(@Nullable String target) { return this; } - public Source withType(@Nullable SourceType type) { this.type = type; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -181,33 +173,36 @@ public boolean equals(java.lang.Object o) { return false; } Source other = (Source) o; - return - Utils.enhancedDeepEquals(this.content, other.content) && - Utils.enhancedDeepEquals(this.encoding, other.encoding) && - Utils.enhancedDeepEquals(this.source, other.source) && - Utils.enhancedDeepEquals(this.target, other.target) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.content, other.content) + && Utils.enhancedDeepEquals(this.encoding, other.encoding) + && Utils.enhancedDeepEquals(this.source, other.source) + && Utils.enhancedDeepEquals(this.target, other.target) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - content, encoding, source, - target, type); + return Utils.enhancedHash(content, encoding, source, target, type); } - + @Override public String toString() { - return Utils.toString(Source.class, - "content", content, - "encoding", encoding, - "source", source, - "target", target, - "type", type); + return Utils.toString( + Source.class, + "content", + content, + "encoding", + encoding, + "source", + source, + "target", + target, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String content; @@ -220,7 +215,7 @@ public final static class Builder { private SourceType type; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -241,7 +236,7 @@ public Builder encoding(@Nullable String encoding) { /** * The source of the environment. - * For GCS, this is the GCS path. + * For Cloud Storage, this is the Cloud Storage path. * For GitHub, this is the GitHub path. */ public Builder source(@Nullable String source) { @@ -263,10 +258,7 @@ public Builder type(@Nullable SourceType type) { } public Source build() { - return new Source( - content, encoding, source, - target, type); + return new Source(content, encoding, source, target, type); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/SourceType.java b/src/main/java/com/google/genai/gaos/models/interactions/SourceType.java index 1896b9e4638..2705cb95e1b 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/SourceType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/SourceType.java @@ -56,12 +56,12 @@ private SourceType(String value) { } /** - * Returns a SourceType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a SourceType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as SourceType - */ + */ @JsonCreator public static SourceType of(String value) { synchronized (SourceType.class) { @@ -89,12 +89,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; SourceType other = (SourceType) obj; return Objects.equals(value, other.value); } @@ -128,14 +125,14 @@ private static final Map createEnumsMap() { map.put("skill_registry", SourceTypeEnum.SKILL_REGISTRY); return map; } - - + public enum SourceTypeEnum { GCS("gcs"), INLINE("inline"), REPOSITORY("repository"), - SKILL_REGISTRY("skill_registry"),; + SKILL_REGISTRY("skill_registry"), + ; private final String value; @@ -148,4 +145,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/SpeakerConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/SpeakerConfig.java new file mode 100644 index 00000000000..e2ddf601ddc --- /dev/null +++ b/src/main/java/com/google/genai/gaos/models/interactions/SpeakerConfig.java @@ -0,0 +1,117 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.google.genai.gaos.models.interactions; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.genai.gaos.utils.Utils; +import jakarta.annotation.Nullable; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Optional; + +/** + * SpeakerConfig + * + *

Configuration for multi-speaker and speech generation. + */ +public class SpeakerConfig { + /** + * Individual speaker configurations. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("speakers") + private List speakers; + + @JsonCreator + public SpeakerConfig(@JsonProperty("speakers") @Nullable List speakers) { + this.speakers = speakers; + } + + public SpeakerConfig() { + this(null); + } + + /** + * Individual speaker configurations. + */ + public Optional> speakers() { + return Optional.ofNullable(this.speakers); + } + + public static Builder builder() { + return new Builder(); + } + + /** + * Individual speaker configurations. + */ + public SpeakerConfig withSpeakers(@Nullable List speakers) { + this.speakers = speakers; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpeakerConfig other = (SpeakerConfig) o; + return Utils.enhancedDeepEquals(this.speakers, other.speakers); + } + + @Override + public int hashCode() { + return Utils.enhancedHash(speakers); + } + + @Override + public String toString() { + return Utils.toString(SpeakerConfig.class, "speakers", speakers); + } + + @SuppressWarnings("UnusedReturnValue") + public static final class Builder { + + private List speakers; + + private Builder() { + // force use of static builder() method + } + + /** + * Individual speaker configurations. + */ + public Builder speakers(@Nullable List speakers) { + this.speakers = speakers; + return this; + } + + public SpeakerConfig build() { + return new SpeakerConfig(speakers); + } + } +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/SpeechConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/SpeechConfig.java index 93533714600..b18e35110b8 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/SpeechConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/SpeechConfig.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -31,7 +31,7 @@ /** * SpeechConfig - * + * *

The configuration for speech interaction. */ public class SpeechConfig { @@ -65,7 +65,7 @@ public SpeechConfig( this.speaker = speaker; this.voice = voice; } - + public SpeechConfig() { this(null, null, null); } @@ -95,7 +95,6 @@ public static Builder builder() { return new Builder(); } - /** * The language of the speech. */ @@ -104,7 +103,6 @@ public SpeechConfig withLanguage(@Nullable String language) { return this; } - /** * The speaker's name, it should match the speaker name given in the prompt. */ @@ -113,7 +111,6 @@ public SpeechConfig withSpeaker(@Nullable String speaker) { return this; } - /** * The voice of the speaker. */ @@ -122,7 +119,6 @@ public SpeechConfig withVoice(@Nullable String voice) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -132,28 +128,23 @@ public boolean equals(java.lang.Object o) { return false; } SpeechConfig other = (SpeechConfig) o; - return - Utils.enhancedDeepEquals(this.language, other.language) && - Utils.enhancedDeepEquals(this.speaker, other.speaker) && - Utils.enhancedDeepEquals(this.voice, other.voice); + return Utils.enhancedDeepEquals(this.language, other.language) + && Utils.enhancedDeepEquals(this.speaker, other.speaker) + && Utils.enhancedDeepEquals(this.voice, other.voice); } - + @Override public int hashCode() { - return Utils.enhancedHash( - language, speaker, voice); + return Utils.enhancedHash(language, speaker, voice); } - + @Override public String toString() { - return Utils.toString(SpeechConfig.class, - "language", language, - "speaker", speaker, - "voice", voice); + return Utils.toString(SpeechConfig.class, "language", language, "speaker", speaker, "voice", voice); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String language; @@ -162,7 +153,7 @@ public final static class Builder { private String voice; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -190,9 +181,7 @@ public Builder voice(@Nullable String voice) { } public SpeechConfig build() { - return new SpeechConfig( - language, speaker, voice); + return new SpeechConfig(language, speaker, voice); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/TurnContent.java b/src/main/java/com/google/genai/gaos/models/interactions/SpeechConfigUnion.java similarity index 54% rename from src/main/java/com/google/genai/gaos/models/interactions/TurnContent.java rename to src/main/java/com/google/genai/gaos/models/interactions/SpeechConfigUnion.java index 8b78863b589..08b4f79fa2b 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/TurnContent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/SpeechConfigUnion.java @@ -25,74 +25,80 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; import java.util.Optional; -@JsonDeserialize(using = TurnContent._Deserializer.class) -public class TurnContent { +/** + * SpeechConfigUnion + * + *

Optional. Speech and multi-speaker configuration. + */ +@JsonDeserialize(using = SpeechConfigUnion._Deserializer.class) +public class SpeechConfigUnion { @JsonValue private final TypedObject value; - - private TurnContent(TypedObject value) { + + private SpeechConfigUnion(TypedObject value) { this.value = value; } - public static TurnContent of(List value) { + public static SpeechConfigUnion of(SpeakerConfig value) { Utils.checkNotNull(value, "value"); - return new TurnContent(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new SpeechConfigUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - public static TurnContent of(String value) { + public static SpeechConfigUnion of(List value) { Utils.checkNotNull(value, "value"); - return new TurnContent(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new SpeechConfigUnion( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>() {})); } - + /** - * Returns an {@link Optional} containing the value if it is of type {@code List}, + * Returns an {@link Optional} containing the value if it is of type {@code SpeakerConfig}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code List} value, or empty if not of this type + * @return an {@link Optional} containing the {@code SpeakerConfig} value, or empty if not of this type + */ + public Optional speakerConfig() { + if (value.value() instanceof SpeakerConfig) { + return Optional.of((SpeakerConfig) value.value()); + } + return Optional.empty(); + } + + /** + * Returns an {@link Optional} containing the value if it is of type {@code List}, + * otherwise returns an empty {@link Optional}. + * + * @return an {@link Optional} containing the {@code List} value, or empty if not of this type */ @SuppressWarnings("unchecked") - public Optional> arrayOfContent() { + public Optional> arrayOfSpeechConfig() { if (value.value() instanceof List) { - return Optional.of((List) value.value()); + return Optional.of((List) value.value()); } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value if it is of type {@code String}, - * otherwise returns an empty {@link Optional}. + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. * - * @return an {@link Optional} containing the {@code String} value, or empty if not of this type + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type */ - public Optional string() { - if (value.value() instanceof String) { - return Optional.of((String) value.value()); + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -101,30 +107,29 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - TurnContent other = (TurnContent) o; + SpeechConfigUnion other = (SpeechConfigUnion) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") - public static final class _Deserializer extends OneOfDeserializer { + public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(TurnContent.class, false, - TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + SpeechConfigUnion.class, + false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(TurnContent.class, - "value", value); + return Utils.toString(SpeechConfigUnion.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/StaticMediaProcessing.java b/src/main/java/com/google/genai/gaos/models/interactions/StaticMediaProcessing.java new file mode 100644 index 00000000000..0b552c784ed --- /dev/null +++ b/src/main/java/com/google/genai/gaos/models/interactions/StaticMediaProcessing.java @@ -0,0 +1,218 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.google.genai.gaos.models.interactions; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.genai.gaos.utils.LazySingletonValue; +import com.google.genai.gaos.utils.Utils; +import jakarta.annotation.Nullable; +import java.lang.Double; +import java.lang.Override; +import java.lang.String; +import java.util.Optional; + +public class StaticMediaProcessing { + /** + * Optional. Segment end time. Specified as a decimal number of seconds followed + * by an 's' suffix, e.g., "30s". Must be non-negative and greater than + * `start_offset` if `start_offset` is set. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("end_offset") + private String endOffset; + + /** + * Optional. Video frame-rate sampling density. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("fps") + private Double fps; + + /** + * Optional. Segment start time. Specified as a decimal number of seconds followed + * by an 's' suffix, e.g., "10.5s". Must be non-negative. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("start_offset") + private String startOffset; + + @JsonProperty("type") + private String type; + + @JsonCreator + public StaticMediaProcessing( + @JsonProperty("end_offset") @Nullable String endOffset, + @JsonProperty("fps") @Nullable Double fps, + @JsonProperty("start_offset") @Nullable String startOffset) { + this.endOffset = endOffset; + this.fps = fps; + this.startOffset = startOffset; + this.type = Builder._SINGLETON_VALUE_Type.value(); + } + + public StaticMediaProcessing() { + this(null, null, null); + } + + /** + * Optional. Segment end time. Specified as a decimal number of seconds followed + * by an 's' suffix, e.g., "30s". Must be non-negative and greater than + * `start_offset` if `start_offset` is set. + */ + public Optional endOffset() { + return Optional.ofNullable(this.endOffset); + } + + /** + * Optional. Video frame-rate sampling density. + */ + public Optional fps() { + return Optional.ofNullable(this.fps); + } + + /** + * Optional. Segment start time. Specified as a decimal number of seconds followed + * by an 's' suffix, e.g., "10.5s". Must be non-negative. + */ + public Optional startOffset() { + return Optional.ofNullable(this.startOffset); + } + + public Optional type() { + return Optional.ofNullable(this.type); + } + + public static Builder builder() { + return new Builder(); + } + + /** + * Optional. Segment end time. Specified as a decimal number of seconds followed + * by an 's' suffix, e.g., "30s". Must be non-negative and greater than + * `start_offset` if `start_offset` is set. + */ + public StaticMediaProcessing withEndOffset(@Nullable String endOffset) { + this.endOffset = endOffset; + return this; + } + + /** + * Optional. Video frame-rate sampling density. + */ + public StaticMediaProcessing withFps(@Nullable Double fps) { + this.fps = fps; + return this; + } + + /** + * Optional. Segment start time. Specified as a decimal number of seconds followed + * by an 's' suffix, e.g., "10.5s". Must be non-negative. + */ + public StaticMediaProcessing withStartOffset(@Nullable String startOffset) { + this.startOffset = startOffset; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StaticMediaProcessing other = (StaticMediaProcessing) o; + return Utils.enhancedDeepEquals(this.endOffset, other.endOffset) + && Utils.enhancedDeepEquals(this.fps, other.fps) + && Utils.enhancedDeepEquals(this.startOffset, other.startOffset) + && Utils.enhancedDeepEquals(this.type, other.type); + } + + @Override + public int hashCode() { + return Utils.enhancedHash(endOffset, fps, startOffset, type); + } + + @Override + public String toString() { + return Utils.toString( + StaticMediaProcessing.class, + "endOffset", + endOffset, + "fps", + fps, + "startOffset", + startOffset, + "type", + type); + } + + @SuppressWarnings("UnusedReturnValue") + public static final class Builder { + + private String endOffset; + + private Double fps; + + private String startOffset; + + private Builder() { + // force use of static builder() method + } + + /** + * Optional. Segment end time. Specified as a decimal number of seconds followed + * by an 's' suffix, e.g., "30s". Must be non-negative and greater than + * `start_offset` if `start_offset` is set. + */ + public Builder endOffset(@Nullable String endOffset) { + this.endOffset = endOffset; + return this; + } + + /** + * Optional. Video frame-rate sampling density. + */ + public Builder fps(@Nullable Double fps) { + this.fps = fps; + return this; + } + + /** + * Optional. Segment start time. Specified as a decimal number of seconds followed + * by an 's' suffix, e.g., "10.5s". Must be non-negative. + */ + public Builder startOffset(@Nullable String startOffset) { + this.startOffset = startOffset; + return this; + } + + public StaticMediaProcessing build() { + return new StaticMediaProcessing(endOffset, fps, startOffset); + } + + private static final LazySingletonValue _SINGLETON_VALUE_Type = + new LazySingletonValue<>("type", "\"static\"", new TypeReference() {}); + } +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Status.java b/src/main/java/com/google/genai/gaos/models/interactions/Status.java index 00597cace79..0fe90e888ce 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Status.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Status.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -35,12 +35,12 @@ /** * Status - * + * *

The `Status` type defines a logical error model that is suitable for * different programming environments, including REST APIs and RPC APIs. It is * used by [gRPC](https://github.com/grpc). Each `Status` message contains * three pieces of data: error code, error message, and error details. - * + * *

You can find out more about this error model and how to work with it in the * [API Design Guide](https://cloud.google.com/apis/design/errors). */ @@ -78,7 +78,7 @@ public Status( this.details = details; this.message = message; } - + public Status() { this(null, null, null); } @@ -111,7 +111,6 @@ public static Builder builder() { return new Builder(); } - /** * The status code, which should be an enum value of google.rpc.Code. */ @@ -120,7 +119,6 @@ public Status withCode(@Nullable Integer code) { return this; } - /** * A list of messages that carry the error details. There is a common set of * message types for APIs to use. @@ -130,7 +128,6 @@ public Status withDetails(@Nullable List> details) { return this; } - /** * A developer-facing error message, which should be in English. Any * user-facing error message should be localized and sent in the @@ -141,7 +138,6 @@ public Status withMessage(@Nullable String message) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -151,28 +147,23 @@ public boolean equals(java.lang.Object o) { return false; } Status other = (Status) o; - return - Utils.enhancedDeepEquals(this.code, other.code) && - Utils.enhancedDeepEquals(this.details, other.details) && - Utils.enhancedDeepEquals(this.message, other.message); + return Utils.enhancedDeepEquals(this.code, other.code) + && Utils.enhancedDeepEquals(this.details, other.details) + && Utils.enhancedDeepEquals(this.message, other.message); } - + @Override public int hashCode() { - return Utils.enhancedHash( - code, details, message); + return Utils.enhancedHash(code, details, message); } - + @Override public String toString() { - return Utils.toString(Status.class, - "code", code, - "details", details, - "message", message); + return Utils.toString(Status.class, "code", code, "details", details, "message", message); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Integer code; @@ -181,7 +172,7 @@ public final static class Builder { private String message; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -212,9 +203,7 @@ public Builder message(@Nullable String message) { } public Status build() { - return new Status( - code, details, message); + return new Status(code, details, message); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Step.java b/src/main/java/com/google/genai/gaos/models/interactions/Step.java index e1dd1253b60..3b502313d9f 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Step.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Step.java @@ -19,15 +19,15 @@ */ package com.google.genai.gaos.models.interactions; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; -import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver; import java.lang.String; /** * Step - * + * *

A step in the interaction. */ @JsonTypeInfo( @@ -35,12 +35,9 @@ property = "type", include = As.EXISTING_PROPERTY, visible = true, - defaultImpl = UnknownStep.class -) + defaultImpl = UnknownStep.class) @JsonTypeIdResolver(StepTypeIdResolver.class) public interface Step { String type(); - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/StepDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/StepDelta.java index 01aa57fc215..fc43774cd53 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/StepDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/StepDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -33,7 +33,6 @@ import java.lang.String; import java.util.Optional; - public class StepDelta implements InteractionSSEEvent { @JsonProperty("delta") @@ -47,11 +46,9 @@ public class StepDelta implements InteractionSSEEvent { @JsonProperty("event_id") private String eventId; - @JsonProperty("event_type") private String eventType; - @JsonProperty("index") private int index; @@ -68,19 +65,15 @@ public StepDelta( @JsonProperty("event_id") @Nullable String eventId, @JsonProperty("index") int index, @JsonProperty("metadata") @Nullable StepDeltaMetadata metadata) { - this.delta = Optional.ofNullable(delta) - .orElseThrow(() -> new IllegalArgumentException("delta cannot be null")); + this.delta = Optional.ofNullable(delta).orElseThrow(() -> new IllegalArgumentException("delta cannot be null")); this.eventId = eventId; this.eventType = Builder._SINGLETON_VALUE_EventType.value(); this.index = index; this.metadata = metadata; } - - public StepDelta( - @Nonnull StepDeltaData delta, - int index) { - this(delta, null, index, - null); + + public StepDelta(@Nonnull StepDeltaData delta, int index) { + this(delta, null, index, null); } public Optional delta() { @@ -115,13 +108,11 @@ public static Builder builder() { return new Builder(); } - public StepDelta withDelta(@Nonnull StepDeltaData delta) { this.delta = Utils.checkNotNull(delta, "delta"); return this; } - /** * The event_id token to be used to resume the interaction stream, from * this event. @@ -131,13 +122,11 @@ public StepDelta withEventId(@Nullable String eventId) { return this; } - public StepDelta withIndex(int index) { this.index = index; return this; } - /** * Optional metadata accompanying ANY streamed event. */ @@ -146,7 +135,6 @@ public StepDelta withMetadata(@Nullable StepDeltaMetadata metadata) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -156,33 +144,36 @@ public boolean equals(java.lang.Object o) { return false; } StepDelta other = (StepDelta) o; - return - Utils.enhancedDeepEquals(this.delta, other.delta) && - Utils.enhancedDeepEquals(this.eventId, other.eventId) && - Utils.enhancedDeepEquals(this.eventType, other.eventType) && - Utils.enhancedDeepEquals(this.index, other.index) && - Utils.enhancedDeepEquals(this.metadata, other.metadata); - } - + return Utils.enhancedDeepEquals(this.delta, other.delta) + && Utils.enhancedDeepEquals(this.eventId, other.eventId) + && Utils.enhancedDeepEquals(this.eventType, other.eventType) + && Utils.enhancedDeepEquals(this.index, other.index) + && Utils.enhancedDeepEquals(this.metadata, other.metadata); + } + @Override public int hashCode() { - return Utils.enhancedHash( - delta, eventId, eventType, - index, metadata); + return Utils.enhancedHash(delta, eventId, eventType, index, metadata); } - + @Override public String toString() { - return Utils.toString(StepDelta.class, - "delta", delta, - "eventId", eventId, - "eventType", eventType, - "index", index, - "metadata", metadata); + return Utils.toString( + StepDelta.class, + "delta", + delta, + "eventId", + eventId, + "eventType", + eventType, + "index", + index, + "metadata", + metadata); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private StepDeltaData delta; @@ -193,7 +184,7 @@ public final static class Builder { private StepDeltaMetadata metadata; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder delta(@Nonnull StepDeltaData delta) { @@ -224,16 +215,10 @@ public Builder metadata(@Nullable StepDeltaMetadata metadata) { } public StepDelta build() { - return new StepDelta( - delta, eventId, index, - metadata); + return new StepDelta(delta, eventId, index, metadata); } - private static final LazySingletonValue _SINGLETON_VALUE_EventType = - new LazySingletonValue<>( - "event_type", - "\"step.delta\"", - new TypeReference() {}); + new LazySingletonValue<>("event_type", "\"step.delta\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/StepDeltaData.java b/src/main/java/com/google/genai/gaos/models/interactions/StepDeltaData.java index f585affc217..e0710ed92d7 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/StepDeltaData.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/StepDeltaData.java @@ -19,9 +19,9 @@ */ package com.google.genai.gaos.models.interactions; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; -import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver; import java.lang.String; @@ -30,12 +30,9 @@ property = "type", include = As.EXISTING_PROPERTY, visible = true, - defaultImpl = UnknownStepDeltaData.class -) + defaultImpl = UnknownStepDeltaData.class) @JsonTypeIdResolver(StepDeltaDataTypeIdResolver.class) public interface StepDeltaData { String type(); - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/StepDeltaDataTypeIdResolver.java b/src/main/java/com/google/genai/gaos/models/interactions/StepDeltaDataTypeIdResolver.java index 3a3eec59cb0..dc58a589da1 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/StepDeltaDataTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/StepDeltaDataTypeIdResolver.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.google.genai.gaos.utils.GenericTypeIdResolver; @@ -26,7 +25,6 @@ import java.lang.Override; import java.lang.String; - public class StepDeltaDataTypeIdResolver extends GenericTypeIdResolver { public StepDeltaDataTypeIdResolver() { @@ -66,19 +64,19 @@ public String idFromValue(Object value) { if (value == null) { return null; } - + // Handle known types by checking if they implement the discriminator method if (value instanceof StepDeltaData) { StepDeltaData discriminated = (StepDeltaData) value; return discriminated.type(); } - - throw new IllegalArgumentException("Unknown value type: " + value.getClass().getName()); + + throw new IllegalArgumentException( + "Unknown value type: " + value.getClass().getName()); } @Override public String getDescForKnownTypeIds() { return "StepDeltaData type resolver"; } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/StepDeltaMetadata.java b/src/main/java/com/google/genai/gaos/models/interactions/StepDeltaMetadata.java index 17ed2d1f101..c09f53bbfe7 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/StepDeltaMetadata.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/StepDeltaMetadata.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -31,7 +31,7 @@ /** * StepDeltaMetadata - * + * *

Optional metadata accompanying ANY streamed event. */ public class StepDeltaMetadata { @@ -43,11 +43,10 @@ public class StepDeltaMetadata { private Usage totalUsage; @JsonCreator - public StepDeltaMetadata( - @JsonProperty("total_usage") @Nullable Usage totalUsage) { + public StepDeltaMetadata(@JsonProperty("total_usage") @Nullable Usage totalUsage) { this.totalUsage = totalUsage; } - + public StepDeltaMetadata() { this(null); } @@ -63,7 +62,6 @@ public static Builder builder() { return new Builder(); } - /** * Statistics on the interaction request's token usage. */ @@ -72,7 +70,6 @@ public StepDeltaMetadata withTotalUsage(@Nullable Usage totalUsage) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -82,29 +79,26 @@ public boolean equals(java.lang.Object o) { return false; } StepDeltaMetadata other = (StepDeltaMetadata) o; - return - Utils.enhancedDeepEquals(this.totalUsage, other.totalUsage); + return Utils.enhancedDeepEquals(this.totalUsage, other.totalUsage); } - + @Override public int hashCode() { - return Utils.enhancedHash( - totalUsage); + return Utils.enhancedHash(totalUsage); } - + @Override public String toString() { - return Utils.toString(StepDeltaMetadata.class, - "totalUsage", totalUsage); + return Utils.toString(StepDeltaMetadata.class, "totalUsage", totalUsage); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Usage totalUsage; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -116,9 +110,7 @@ public Builder totalUsage(@Nullable Usage totalUsage) { } public StepDeltaMetadata build() { - return new StepDeltaMetadata( - totalUsage); + return new StepDeltaMetadata(totalUsage); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/StepStart.java b/src/main/java/com/google/genai/gaos/models/interactions/StepStart.java index c5edd26e50a..c41b8838b15 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/StepStart.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/StepStart.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -33,7 +33,6 @@ import java.lang.String; import java.util.Optional; - public class StepStart implements InteractionSSEEvent { /** * The event_id token to be used to resume the interaction stream, from @@ -43,11 +42,9 @@ public class StepStart implements InteractionSSEEvent { @JsonProperty("event_id") private String eventId; - @JsonProperty("event_type") private String eventType; - @JsonProperty("index") private int index; @@ -65,13 +62,10 @@ public StepStart( this.eventId = eventId; this.eventType = Builder._SINGLETON_VALUE_EventType.value(); this.index = index; - this.step = Optional.ofNullable(step) - .orElseThrow(() -> new IllegalArgumentException("step cannot be null")); + this.step = Optional.ofNullable(step).orElseThrow(() -> new IllegalArgumentException("step cannot be null")); } - - public StepStart( - int index, - @Nonnull Step step) { + + public StepStart(int index, @Nonnull Step step) { this(null, index, step); } @@ -103,7 +97,6 @@ public static Builder builder() { return new Builder(); } - /** * The event_id token to be used to resume the interaction stream, from * this event. @@ -113,13 +106,11 @@ public StepStart withEventId(@Nullable String eventId) { return this; } - public StepStart withIndex(int index) { this.index = index; return this; } - /** * A step in the interaction. */ @@ -128,7 +119,6 @@ public StepStart withStep(@Nonnull Step step) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -138,31 +128,25 @@ public boolean equals(java.lang.Object o) { return false; } StepStart other = (StepStart) o; - return - Utils.enhancedDeepEquals(this.eventId, other.eventId) && - Utils.enhancedDeepEquals(this.eventType, other.eventType) && - Utils.enhancedDeepEquals(this.index, other.index) && - Utils.enhancedDeepEquals(this.step, other.step); + return Utils.enhancedDeepEquals(this.eventId, other.eventId) + && Utils.enhancedDeepEquals(this.eventType, other.eventType) + && Utils.enhancedDeepEquals(this.index, other.index) + && Utils.enhancedDeepEquals(this.step, other.step); } - + @Override public int hashCode() { - return Utils.enhancedHash( - eventId, eventType, index, - step); + return Utils.enhancedHash(eventId, eventType, index, step); } - + @Override public String toString() { - return Utils.toString(StepStart.class, - "eventId", eventId, - "eventType", eventType, - "index", index, - "step", step); + return Utils.toString( + StepStart.class, "eventId", eventId, "eventType", eventType, "index", index, "step", step); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String eventId; @@ -171,7 +155,7 @@ public final static class Builder { private Step step; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -197,15 +181,10 @@ public Builder step(@Nonnull Step step) { } public StepStart build() { - return new StepStart( - eventId, index, step); + return new StepStart(eventId, index, step); } - private static final LazySingletonValue _SINGLETON_VALUE_EventType = - new LazySingletonValue<>( - "event_type", - "\"step.start\"", - new TypeReference() {}); + new LazySingletonValue<>("event_type", "\"step.start\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/StepStop.java b/src/main/java/com/google/genai/gaos/models/interactions/StepStop.java index ce5888633b3..efd56fedc3b 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/StepStop.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/StepStop.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -32,7 +32,6 @@ import java.lang.String; import java.util.Optional; - public class StepStop implements InteractionSSEEvent { /** * The event_id token to be used to resume the interaction stream, from @@ -42,11 +41,9 @@ public class StepStop implements InteractionSSEEvent { @JsonProperty("event_id") private String eventId; - @JsonProperty("event_type") private String eventType; - @JsonProperty("index") private int index; @@ -76,11 +73,9 @@ public StepStop( this.stepUsage = stepUsage; this.usage = usage; } - - public StepStop( - int index) { - this(null, index, null, - null); + + public StepStop(int index) { + this(null, index, null, null); } /** @@ -118,7 +113,6 @@ public static Builder builder() { return new Builder(); } - /** * The event_id token to be used to resume the interaction stream, from * this event. @@ -128,13 +122,11 @@ public StepStop withEventId(@Nullable String eventId) { return this; } - public StepStop withIndex(int index) { this.index = index; return this; } - /** * Statistics on the interaction request's token usage. */ @@ -143,7 +135,6 @@ public StepStop withStepUsage(@Nullable Usage stepUsage) { return this; } - /** * Statistics on the interaction request's token usage. */ @@ -152,7 +143,6 @@ public StepStop withUsage(@Nullable Usage usage) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -162,33 +152,36 @@ public boolean equals(java.lang.Object o) { return false; } StepStop other = (StepStop) o; - return - Utils.enhancedDeepEquals(this.eventId, other.eventId) && - Utils.enhancedDeepEquals(this.eventType, other.eventType) && - Utils.enhancedDeepEquals(this.index, other.index) && - Utils.enhancedDeepEquals(this.stepUsage, other.stepUsage) && - Utils.enhancedDeepEquals(this.usage, other.usage); - } - + return Utils.enhancedDeepEquals(this.eventId, other.eventId) + && Utils.enhancedDeepEquals(this.eventType, other.eventType) + && Utils.enhancedDeepEquals(this.index, other.index) + && Utils.enhancedDeepEquals(this.stepUsage, other.stepUsage) + && Utils.enhancedDeepEquals(this.usage, other.usage); + } + @Override public int hashCode() { - return Utils.enhancedHash( - eventId, eventType, index, - stepUsage, usage); + return Utils.enhancedHash(eventId, eventType, index, stepUsage, usage); } - + @Override public String toString() { - return Utils.toString(StepStop.class, - "eventId", eventId, - "eventType", eventType, - "index", index, - "stepUsage", stepUsage, - "usage", usage); + return Utils.toString( + StepStop.class, + "eventId", + eventId, + "eventType", + eventType, + "index", + index, + "stepUsage", + stepUsage, + "usage", + usage); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String eventId; @@ -199,7 +192,7 @@ public final static class Builder { private Usage usage; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -233,16 +226,10 @@ public Builder usage(@Nullable Usage usage) { } public StepStop build() { - return new StepStop( - eventId, index, stepUsage, - usage); + return new StepStop(eventId, index, stepUsage, usage); } - private static final LazySingletonValue _SINGLETON_VALUE_EventType = - new LazySingletonValue<>( - "event_type", - "\"step.stop\"", - new TypeReference() {}); + new LazySingletonValue<>("event_type", "\"step.stop\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/StepTypeIdResolver.java b/src/main/java/com/google/genai/gaos/models/interactions/StepTypeIdResolver.java index 7af5bf920a2..34c4493a4cf 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/StepTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/StepTypeIdResolver.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.google.genai.gaos.utils.GenericTypeIdResolver; @@ -26,10 +25,9 @@ import java.lang.Override; import java.lang.String; - /** * StepTypeIdResolver - * + * *

A step in the interaction. */ public class StepTypeIdResolver extends GenericTypeIdResolver { @@ -64,19 +62,19 @@ public String idFromValue(Object value) { if (value == null) { return null; } - + // Handle known types by checking if they implement the discriminator method if (value instanceof Step) { Step discriminated = (Step) value; return discriminated.type(); } - - throw new IllegalArgumentException("Unknown value type: " + value.getClass().getName()); + + throw new IllegalArgumentException( + "Unknown value type: " + value.getClass().getName()); } @Override public String getDescForKnownTypeIds() { return "Step type resolver"; } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Task.java b/src/main/java/com/google/genai/gaos/models/interactions/Task.java index 881fbad7300..7863c0d81bc 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Task.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Task.java @@ -36,7 +36,7 @@ */ /** * Task - * + * *

Optional task mode for video generation. If not specified, the model * automatically determines the appropriate mode based on the provided text * prompt and input media. @@ -47,6 +47,7 @@ public class Task { public static final Task IMAGE_TO_VIDEO = new Task("image_to_video"); public static final Task REFERENCE_TO_VIDEO = new Task("reference_to_video"); public static final Task EDIT = new Task("edit"); + public static final Task EXTEND = new Task("extend"); // This map will grow whenever a Color gets created with a new // unrecognized value (a potential memory leak if the user is not @@ -63,12 +64,12 @@ private Task(String value) { } /** - * Returns a Task with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a Task with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as Task - */ + */ @JsonCreator public static Task of(String value) { synchronized (Task.class) { @@ -96,12 +97,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; Task other = (Task) obj; return Objects.equals(value, other.value); } @@ -124,6 +122,7 @@ private static final Map createValuesMap() { map.put("image_to_video", IMAGE_TO_VIDEO); map.put("reference_to_video", REFERENCE_TO_VIDEO); map.put("edit", EDIT); + map.put("extend", EXTEND); return map; } @@ -133,16 +132,18 @@ private static final Map createEnumsMap() { map.put("image_to_video", TaskEnum.IMAGE_TO_VIDEO); map.put("reference_to_video", TaskEnum.REFERENCE_TO_VIDEO); map.put("edit", TaskEnum.EDIT); + map.put("extend", TaskEnum.EXTEND); return map; } - - + public enum TaskEnum { TEXT_TO_VIDEO("text_to_video"), IMAGE_TO_VIDEO("image_to_video"), REFERENCE_TO_VIDEO("reference_to_video"), - EDIT("edit"),; + EDIT("edit"), + EXTEND("extend"), + ; private final String value; @@ -155,4 +156,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/TextAnnotationDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/TextAnnotationDelta.java index 9f85f2540ed..b8ba61e8440 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/TextAnnotationDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/TextAnnotationDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -32,7 +32,6 @@ import java.util.List; import java.util.Optional; - public class TextAnnotationDelta implements StepDeltaData { /** * Citation information for model-generated content. @@ -41,17 +40,15 @@ public class TextAnnotationDelta implements StepDeltaData { @JsonProperty("annotations") private List annotations; - @JsonProperty("type") private String type; @JsonCreator - public TextAnnotationDelta( - @JsonProperty("annotations") @Nullable List annotations) { + public TextAnnotationDelta(@JsonProperty("annotations") @Nullable List annotations) { this.annotations = annotations; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public TextAnnotationDelta() { this(null); } @@ -72,7 +69,6 @@ public static Builder builder() { return new Builder(); } - /** * Citation information for model-generated content. */ @@ -81,7 +77,6 @@ public TextAnnotationDelta withAnnotations(@Nullable List annotation return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -91,31 +86,27 @@ public boolean equals(java.lang.Object o) { return false; } TextAnnotationDelta other = (TextAnnotationDelta) o; - return - Utils.enhancedDeepEquals(this.annotations, other.annotations) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.annotations, other.annotations) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - annotations, type); + return Utils.enhancedHash(annotations, type); } - + @Override public String toString() { - return Utils.toString(TextAnnotationDelta.class, - "annotations", annotations, - "type", type); + return Utils.toString(TextAnnotationDelta.class, "annotations", annotations, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List annotations; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -127,15 +118,10 @@ public Builder annotations(@Nullable List annotations) { } public TextAnnotationDelta build() { - return new TextAnnotationDelta( - annotations); + return new TextAnnotationDelta(annotations); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"text_annotation_delta\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"text_annotation_delta\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/TextContent.java b/src/main/java/com/google/genai/gaos/models/interactions/TextContent.java index 93ec66c0b8e..41755b26301 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/TextContent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/TextContent.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -35,7 +35,7 @@ /** * TextContent - * + * *

A text content block. */ public class TextContent implements Content, ThoughtSummaryContent, FunctionResultSubcontent { @@ -52,7 +52,6 @@ public class TextContent implements Content, ThoughtSummaryContent, FunctionResu @JsonProperty("text") private String text; - @JsonProperty("type") private String type; @@ -61,13 +60,11 @@ public TextContent( @JsonProperty("annotations") @Nullable List annotations, @JsonProperty("text") @Nonnull String text) { this.annotations = annotations; - this.text = Optional.ofNullable(text) - .orElseThrow(() -> new IllegalArgumentException("text cannot be null")); + this.text = Optional.ofNullable(text).orElseThrow(() -> new IllegalArgumentException("text cannot be null")); this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public TextContent( - @Nonnull String text) { + + public TextContent(@Nonnull String text) { this(null, text); } @@ -94,7 +91,6 @@ public static Builder builder() { return new Builder(); } - /** * Citation information for model-generated content. */ @@ -103,7 +99,6 @@ public TextContent withAnnotations(@Nullable List annotations) { return this; } - /** * Required. The text content. */ @@ -112,7 +107,6 @@ public TextContent withText(@Nonnull String text) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -122,35 +116,30 @@ public boolean equals(java.lang.Object o) { return false; } TextContent other = (TextContent) o; - return - Utils.enhancedDeepEquals(this.annotations, other.annotations) && - Utils.enhancedDeepEquals(this.text, other.text) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.annotations, other.annotations) + && Utils.enhancedDeepEquals(this.text, other.text) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - annotations, text, type); + return Utils.enhancedHash(annotations, text, type); } - + @Override public String toString() { - return Utils.toString(TextContent.class, - "annotations", annotations, - "text", text, - "type", type); + return Utils.toString(TextContent.class, "annotations", annotations, "text", text, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List annotations; private String text; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -170,15 +159,10 @@ public Builder text(@Nonnull String text) { } public TextContent build() { - return new TextContent( - annotations, text); + return new TextContent(annotations, text); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"text\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"text\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/TextDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/TextDelta.java index 15b742f2a3e..d319de09441 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/TextDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/TextDelta.java @@ -29,21 +29,17 @@ import java.lang.String; import java.util.Optional; - public class TextDelta implements StepDeltaData { @JsonProperty("text") private String text; - @JsonProperty("type") private String type; @JsonCreator - public TextDelta( - @JsonProperty("text") @Nonnull String text) { - this.text = Optional.ofNullable(text) - .orElseThrow(() -> new IllegalArgumentException("text cannot be null")); + public TextDelta(@JsonProperty("text") @Nonnull String text) { + this.text = Optional.ofNullable(text).orElseThrow(() -> new IllegalArgumentException("text cannot be null")); this.type = Builder._SINGLETON_VALUE_Type.value(); } @@ -60,13 +56,11 @@ public static Builder builder() { return new Builder(); } - public TextDelta withText(@Nonnull String text) { this.text = Utils.checkNotNull(text, "text"); return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -76,31 +70,26 @@ public boolean equals(java.lang.Object o) { return false; } TextDelta other = (TextDelta) o; - return - Utils.enhancedDeepEquals(this.text, other.text) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.text, other.text) && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - text, type); + return Utils.enhancedHash(text, type); } - + @Override public String toString() { - return Utils.toString(TextDelta.class, - "text", text, - "type", type); + return Utils.toString(TextDelta.class, "text", text, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String text; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder text(@Nonnull String text) { @@ -109,15 +98,10 @@ public Builder text(@Nonnull String text) { } public TextDelta build() { - return new TextDelta( - text); + return new TextDelta(text); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"text\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"text\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/TextResponseFormat.java b/src/main/java/com/google/genai/gaos/models/interactions/TextResponseFormat.java index a6ea45c3a06..72c94482bf5 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/TextResponseFormat.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/TextResponseFormat.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -35,7 +35,7 @@ /** * TextResponseFormat - * + * *

Configuration for text output format. */ public class TextResponseFormat { @@ -54,7 +54,6 @@ public class TextResponseFormat { @JsonProperty("schema") private Map schema; - @JsonProperty("type") private String type; @@ -66,7 +65,7 @@ public TextResponseFormat( this.schema = schema; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public TextResponseFormat() { this(null, null); } @@ -94,7 +93,6 @@ public static Builder builder() { return new Builder(); } - /** * The MIME type of the text output. */ @@ -103,7 +101,6 @@ public TextResponseFormat withMimeType(@Nullable TextResponseFormatMimeType mime return this; } - /** * The JSON schema that the output should conform to. Only applicable when * mime_type is application/json. @@ -113,7 +110,6 @@ public TextResponseFormat withSchema(@Nullable Map schema) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -123,35 +119,30 @@ public boolean equals(java.lang.Object o) { return false; } TextResponseFormat other = (TextResponseFormat) o; - return - Utils.enhancedDeepEquals(this.mimeType, other.mimeType) && - Utils.enhancedDeepEquals(this.schema, other.schema) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.mimeType, other.mimeType) + && Utils.enhancedDeepEquals(this.schema, other.schema) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - mimeType, schema, type); + return Utils.enhancedHash(mimeType, schema, type); } - + @Override public String toString() { - return Utils.toString(TextResponseFormat.class, - "mimeType", mimeType, - "schema", schema, - "type", type); + return Utils.toString(TextResponseFormat.class, "mimeType", mimeType, "schema", schema, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private TextResponseFormatMimeType mimeType; private Map schema; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -172,15 +163,10 @@ public Builder schema(@Nullable Map schema) { } public TextResponseFormat build() { - return new TextResponseFormat( - mimeType, schema); + return new TextResponseFormat(mimeType, schema); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"text\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"text\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/TextResponseFormatMimeType.java b/src/main/java/com/google/genai/gaos/models/interactions/TextResponseFormatMimeType.java index 5244fdc401c..678592ea11d 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/TextResponseFormatMimeType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/TextResponseFormatMimeType.java @@ -36,12 +36,13 @@ */ /** * TextResponseFormatMimeType - * + * *

The MIME type of the text output. */ public class TextResponseFormatMimeType { - public static final TextResponseFormatMimeType APPLICATION_JSON = new TextResponseFormatMimeType("application/json"); + public static final TextResponseFormatMimeType APPLICATION_JSON = + new TextResponseFormatMimeType("application/json"); public static final TextResponseFormatMimeType TEXT_PLAIN = new TextResponseFormatMimeType("text/plain"); // This map will grow whenever a Color gets created with a new @@ -59,12 +60,12 @@ private TextResponseFormatMimeType(String value) { } /** - * Returns a TextResponseFormatMimeType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a TextResponseFormatMimeType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as TextResponseFormatMimeType - */ + */ @JsonCreator public static TextResponseFormatMimeType of(String value) { synchronized (TextResponseFormatMimeType.class) { @@ -92,12 +93,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; TextResponseFormatMimeType other = (TextResponseFormatMimeType) obj; return Objects.equals(value, other.value); } @@ -127,12 +125,12 @@ private static final Map createEnumsMap( map.put("text/plain", TextResponseFormatMimeTypeEnum.TEXT_PLAIN); return map; } - - + public enum TextResponseFormatMimeTypeEnum { APPLICATION_JSON("application/json"), - TEXT_PLAIN("text/plain"),; + TEXT_PLAIN("text/plain"), + ; private final String value; @@ -145,4 +143,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ThinkingLevel.java b/src/main/java/com/google/genai/gaos/models/interactions/ThinkingLevel.java index 61d1f4fab90..33b8b8a8b98 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ThinkingLevel.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ThinkingLevel.java @@ -56,12 +56,12 @@ private ThinkingLevel(String value) { } /** - * Returns a ThinkingLevel with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a ThinkingLevel with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as ThinkingLevel - */ + */ @JsonCreator public static ThinkingLevel of(String value) { synchronized (ThinkingLevel.class) { @@ -89,12 +89,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; ThinkingLevel other = (ThinkingLevel) obj; return Objects.equals(value, other.value); } @@ -128,14 +125,14 @@ private static final Map createEnumsMap() { map.put("high", ThinkingLevelEnum.HIGH); return map; } - - + public enum ThinkingLevelEnum { MINIMAL("minimal"), LOW("low"), MEDIUM("medium"), - HIGH("high"),; + HIGH("high"), + ; private final String value; @@ -148,4 +145,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ThinkingSummaries.java b/src/main/java/com/google/genai/gaos/models/interactions/ThinkingSummaries.java index 4bf31a4e994..92828cf24f3 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ThinkingSummaries.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ThinkingSummaries.java @@ -54,12 +54,12 @@ private ThinkingSummaries(String value) { } /** - * Returns a ThinkingSummaries with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a ThinkingSummaries with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as ThinkingSummaries - */ + */ @JsonCreator public static ThinkingSummaries of(String value) { synchronized (ThinkingSummaries.class) { @@ -87,12 +87,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; ThinkingSummaries other = (ThinkingSummaries) obj; return Objects.equals(value, other.value); } @@ -122,12 +119,12 @@ private static final Map createEnumsMap() { map.put("none", ThinkingSummariesEnum.NONE); return map; } - - + public enum ThinkingSummariesEnum { AUTO("auto"), - NONE("none"),; + NONE("none"), + ; private final String value; @@ -140,4 +137,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ThoughtSignatureDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/ThoughtSignatureDelta.java index 7d01b6d1830..4f3295ef11f 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ThoughtSignatureDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ThoughtSignatureDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class ThoughtSignatureDelta implements StepDeltaData { /** * Signature to match the backend source to be part of the generation. @@ -40,17 +39,15 @@ public class ThoughtSignatureDelta implements StepDeltaData { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @JsonCreator - public ThoughtSignatureDelta( - @JsonProperty("signature") @Nullable String signature) { + public ThoughtSignatureDelta(@JsonProperty("signature") @Nullable String signature) { this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public ThoughtSignatureDelta() { this(null); } @@ -71,7 +68,6 @@ public static Builder builder() { return new Builder(); } - /** * Signature to match the backend source to be part of the generation. */ @@ -80,7 +76,6 @@ public ThoughtSignatureDelta withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -90,31 +85,27 @@ public boolean equals(java.lang.Object o) { return false; } ThoughtSignatureDelta other = (ThoughtSignatureDelta) o; - return - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - signature, type); + return Utils.enhancedHash(signature, type); } - + @Override public String toString() { - return Utils.toString(ThoughtSignatureDelta.class, - "signature", signature, - "type", type); + return Utils.toString(ThoughtSignatureDelta.class, "signature", signature, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -126,15 +117,10 @@ public Builder signature(@Nullable String signature) { } public ThoughtSignatureDelta build() { - return new ThoughtSignatureDelta( - signature); + return new ThoughtSignatureDelta(signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"thought_signature\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"thought_signature\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ThoughtStep.java b/src/main/java/com/google/genai/gaos/models/interactions/ThoughtStep.java index 52cda819b95..39279a783a3 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ThoughtStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ThoughtStep.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * ThoughtStep - * + * *

A thought step. */ public class ThoughtStep implements Step { @@ -52,7 +52,6 @@ public class ThoughtStep implements Step { @JsonProperty("summary") private List summary; - @JsonProperty("type") private String type; @@ -64,7 +63,7 @@ public ThoughtStep( this.summary = summary; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public ThoughtStep() { this(null, null); } @@ -92,7 +91,6 @@ public static Builder builder() { return new Builder(); } - /** * A signature hash for backend validation. */ @@ -101,7 +99,6 @@ public ThoughtStep withSignature(@Nullable String signature) { return this; } - /** * A summary of the thought. */ @@ -110,7 +107,6 @@ public ThoughtStep withSummary(@Nullable List summary) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -120,35 +116,30 @@ public boolean equals(java.lang.Object o) { return false; } ThoughtStep other = (ThoughtStep) o; - return - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.summary, other.summary) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.summary, other.summary) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - signature, summary, type); + return Utils.enhancedHash(signature, summary, type); } - + @Override public String toString() { - return Utils.toString(ThoughtStep.class, - "signature", signature, - "summary", summary, - "type", type); + return Utils.toString(ThoughtStep.class, "signature", signature, "summary", summary, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String signature; private List summary; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -168,15 +159,10 @@ public Builder summary(@Nullable List summary) { } public ThoughtStep build() { - return new ThoughtStep( - signature, summary); + return new ThoughtStep(signature, summary); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"thought\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"thought\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ThoughtSummaryContent.java b/src/main/java/com/google/genai/gaos/models/interactions/ThoughtSummaryContent.java index be80c8c0589..9c2e2ffe518 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ThoughtSummaryContent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ThoughtSummaryContent.java @@ -19,9 +19,9 @@ */ package com.google.genai.gaos.models.interactions; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; -import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver; import java.lang.String; @@ -30,12 +30,9 @@ property = "type", include = As.EXISTING_PROPERTY, visible = true, - defaultImpl = UnknownThoughtSummaryContent.class -) + defaultImpl = UnknownThoughtSummaryContent.class) @JsonTypeIdResolver(ThoughtSummaryContentTypeIdResolver.class) public interface ThoughtSummaryContent { String type(); - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ThoughtSummaryContentTypeIdResolver.java b/src/main/java/com/google/genai/gaos/models/interactions/ThoughtSummaryContentTypeIdResolver.java index a4dc99563a5..6eb87227fb7 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ThoughtSummaryContentTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ThoughtSummaryContentTypeIdResolver.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.google.genai.gaos.utils.GenericTypeIdResolver; @@ -26,7 +25,6 @@ import java.lang.Override; import java.lang.String; - public class ThoughtSummaryContentTypeIdResolver extends GenericTypeIdResolver { public ThoughtSummaryContentTypeIdResolver() { @@ -44,19 +42,19 @@ public String idFromValue(Object value) { if (value == null) { return null; } - + // Handle known types by checking if they implement the discriminator method if (value instanceof ThoughtSummaryContent) { ThoughtSummaryContent discriminated = (ThoughtSummaryContent) value; return discriminated.type(); } - - throw new IllegalArgumentException("Unknown value type: " + value.getClass().getName()); + + throw new IllegalArgumentException( + "Unknown value type: " + value.getClass().getName()); } @Override public String getDescForKnownTypeIds() { return "ThoughtSummaryContent type resolver"; } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ThoughtSummaryDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/ThoughtSummaryDelta.java index 71a8e8e7538..6be753bd048 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ThoughtSummaryDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ThoughtSummaryDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class ThoughtSummaryDelta implements StepDeltaData { /** * The content of the response. @@ -40,17 +39,15 @@ public class ThoughtSummaryDelta implements StepDeltaData { @JsonProperty("content") private Content content; - @JsonProperty("type") private String type; @JsonCreator - public ThoughtSummaryDelta( - @JsonProperty("content") @Nullable Content content) { + public ThoughtSummaryDelta(@JsonProperty("content") @Nullable Content content) { this.content = content; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public ThoughtSummaryDelta() { this(null); } @@ -71,7 +68,6 @@ public static Builder builder() { return new Builder(); } - /** * The content of the response. */ @@ -80,7 +76,6 @@ public ThoughtSummaryDelta withContent(@Nullable Content content) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -90,31 +85,26 @@ public boolean equals(java.lang.Object o) { return false; } ThoughtSummaryDelta other = (ThoughtSummaryDelta) o; - return - Utils.enhancedDeepEquals(this.content, other.content) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.content, other.content) && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - content, type); + return Utils.enhancedHash(content, type); } - + @Override public String toString() { - return Utils.toString(ThoughtSummaryDelta.class, - "content", content, - "type", type); + return Utils.toString(ThoughtSummaryDelta.class, "content", content, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Content content; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -126,15 +116,10 @@ public Builder content(@Nullable Content content) { } public ThoughtSummaryDelta build() { - return new ThoughtSummaryDelta( - content); + return new ThoughtSummaryDelta(content); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"thought_summary\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"thought_summary\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Threshold.java b/src/main/java/com/google/genai/gaos/models/interactions/Threshold.java index 8265a115b7d..8af99e89881 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Threshold.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Threshold.java @@ -36,7 +36,7 @@ */ /** * Threshold - * + * *

Required. The threshold for blocking content. If the harm probability * exceeds this threshold, the content will be blocked. */ @@ -63,12 +63,12 @@ private Threshold(String value) { } /** - * Returns a Threshold with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a Threshold with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as Threshold - */ + */ @JsonCreator public static Threshold of(String value) { synchronized (Threshold.class) { @@ -96,12 +96,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; Threshold other = (Threshold) obj; return Objects.equals(value, other.value); } @@ -137,15 +134,15 @@ private static final Map createEnumsMap() { map.put("off", ThresholdEnum.OFF); return map; } - - + public enum ThresholdEnum { BLOCK_LOW_AND_ABOVE("block_low_and_above"), BLOCK_MEDIUM_AND_ABOVE("block_medium_and_above"), BLOCK_ONLY_HIGH("block_only_high"), BLOCK_NONE("block_none"), - OFF("off"),; + OFF("off"), + ; private final String value; @@ -158,4 +155,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Tool.java b/src/main/java/com/google/genai/gaos/models/interactions/Tool.java index 4190658bc9a..00c9e1f86c8 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Tool.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Tool.java @@ -19,15 +19,15 @@ */ package com.google.genai.gaos.models.interactions; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; -import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver; import java.lang.String; /** * Tool - * + * *

A tool that can be used by the model. */ @JsonTypeInfo( @@ -35,12 +35,9 @@ property = "type", include = As.EXISTING_PROPERTY, visible = true, - defaultImpl = UnknownTool.class -) + defaultImpl = UnknownTool.class) @JsonTypeIdResolver(ToolTypeIdResolver.class) public interface Tool { String type(); - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ToolChoice.java b/src/main/java/com/google/genai/gaos/models/interactions/ToolChoice.java index 1be5f9d0b20..017e3abff5e 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ToolChoice.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ToolChoice.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -35,7 +35,7 @@ /** * ToolChoice - * + * *

The tool choice configuration. */ @JsonDeserialize(using = ToolChoice._Deserializer.class) @@ -43,21 +43,21 @@ public class ToolChoice { @JsonValue private final TypedObject value; - + private ToolChoice(TypedObject value) { this.value = value; } public static ToolChoice of(ToolChoiceConfig value) { Utils.checkNotNull(value, "value"); - return new ToolChoice(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new ToolChoice(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static ToolChoice of(ToolChoiceType value) { Utils.checkNotNull(value, "value"); - return new ToolChoice(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new ToolChoice(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code ToolChoiceConfig}, * otherwise returns an empty {@link Optional}. @@ -70,7 +70,7 @@ public Optional toolChoiceConfig() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code ToolChoiceType}, * otherwise returns an empty {@link Optional}. @@ -83,19 +83,19 @@ public Optional toolChoiceType() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -107,27 +107,26 @@ public boolean equals(java.lang.Object o) { ToolChoice other = (ToolChoice) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(ToolChoice.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + ToolChoice.class, + false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(ToolChoice.class, - "value", value); + return Utils.toString(ToolChoice.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ToolChoiceConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/ToolChoiceConfig.java index 1cf36de4233..df535cc0f7e 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ToolChoiceConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ToolChoiceConfig.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -31,7 +31,7 @@ /** * ToolChoiceConfig - * + * *

The tool choice configuration containing allowed tools. */ public class ToolChoiceConfig { @@ -43,11 +43,10 @@ public class ToolChoiceConfig { private AllowedTools allowedTools; @JsonCreator - public ToolChoiceConfig( - @JsonProperty("allowed_tools") @Nullable AllowedTools allowedTools) { + public ToolChoiceConfig(@JsonProperty("allowed_tools") @Nullable AllowedTools allowedTools) { this.allowedTools = allowedTools; } - + public ToolChoiceConfig() { this(null); } @@ -63,7 +62,6 @@ public static Builder builder() { return new Builder(); } - /** * The configuration for allowed tools. */ @@ -72,7 +70,6 @@ public ToolChoiceConfig withAllowedTools(@Nullable AllowedTools allowedTools) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -82,29 +79,26 @@ public boolean equals(java.lang.Object o) { return false; } ToolChoiceConfig other = (ToolChoiceConfig) o; - return - Utils.enhancedDeepEquals(this.allowedTools, other.allowedTools); + return Utils.enhancedDeepEquals(this.allowedTools, other.allowedTools); } - + @Override public int hashCode() { - return Utils.enhancedHash( - allowedTools); + return Utils.enhancedHash(allowedTools); } - + @Override public String toString() { - return Utils.toString(ToolChoiceConfig.class, - "allowedTools", allowedTools); + return Utils.toString(ToolChoiceConfig.class, "allowedTools", allowedTools); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private AllowedTools allowedTools; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -116,9 +110,7 @@ public Builder allowedTools(@Nullable AllowedTools allowedTools) { } public ToolChoiceConfig build() { - return new ToolChoiceConfig( - allowedTools); + return new ToolChoiceConfig(allowedTools); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ToolChoiceType.java b/src/main/java/com/google/genai/gaos/models/interactions/ToolChoiceType.java index 39d42d352fb..d54459bbb5d 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ToolChoiceType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ToolChoiceType.java @@ -56,12 +56,12 @@ private ToolChoiceType(String value) { } /** - * Returns a ToolChoiceType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a ToolChoiceType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as ToolChoiceType - */ + */ @JsonCreator public static ToolChoiceType of(String value) { synchronized (ToolChoiceType.class) { @@ -89,12 +89,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; ToolChoiceType other = (ToolChoiceType) obj; return Objects.equals(value, other.value); } @@ -128,14 +125,14 @@ private static final Map createEnumsMap() { map.put("validated", ToolChoiceTypeEnum.VALIDATED); return map; } - - + public enum ToolChoiceTypeEnum { AUTO("auto"), ANY("any"), NONE("none"), - VALIDATED("validated"),; + VALIDATED("validated"), + ; private final String value; @@ -148,4 +145,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ToolTypeIdResolver.java b/src/main/java/com/google/genai/gaos/models/interactions/ToolTypeIdResolver.java index 5380f94e87e..6153f3a97c7 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ToolTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ToolTypeIdResolver.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.google.genai.gaos.utils.GenericTypeIdResolver; @@ -26,10 +25,9 @@ import java.lang.Override; import java.lang.String; - /** * ToolTypeIdResolver - * + * *

A tool that can be used by the model. */ public class ToolTypeIdResolver extends GenericTypeIdResolver { @@ -56,19 +54,19 @@ public String idFromValue(Object value) { if (value == null) { return null; } - + // Handle known types by checking if they implement the discriminator method if (value instanceof Tool) { Tool discriminated = (Tool) value; return discriminated.type(); } - - throw new IllegalArgumentException("Unknown value type: " + value.getClass().getName()); + + throw new IllegalArgumentException( + "Unknown value type: " + value.getClass().getName()); } @Override public String getDescForKnownTypeIds() { return "Tool type resolver"; } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/TranscriptionConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/TranscriptionConfig.java index e82e30d3540..5c04f05bfc2 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/TranscriptionConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/TranscriptionConfig.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -33,13 +33,13 @@ /** * TranscriptionConfig - * + * *

Configuration for speech recognition (transcription). */ public class TranscriptionConfig { /** * Optional. A list of phrases to bias the ASR model towards. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -91,15 +91,14 @@ public TranscriptionConfig( this.languageCodes = languageCodes; this.timestampGranularities = timestampGranularities; } - + public TranscriptionConfig() { - this(null, null, null, - null, null); + this(null, null, null, null, null); } /** * Optional. A list of phrases to bias the ASR model towards. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -142,10 +141,9 @@ public static Builder builder() { return new Builder(); } - /** * Optional. A list of phrases to bias the ASR model towards. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -154,7 +152,6 @@ public TranscriptionConfig withAdaptationPhrases(@Nullable List adaptati return this; } - /** * Optional. A list of custom vocabulary phrases to bias the speech recognition model * toward recognizing specific terms. @@ -164,7 +161,6 @@ public TranscriptionConfig withCustomVocabulary(@Nullable List customVoc return this; } - /** * Optional. Configures speaker diarization. Supported values: "speaker". */ @@ -173,7 +169,6 @@ public TranscriptionConfig withDiarizationMode(@Nullable String diarizationMode) return this; } - /** * Optional. BCP-47 language codes providing hints about the languages present in the * audio. If omitted or empty, defaults to automatic language detection. @@ -183,7 +178,6 @@ public TranscriptionConfig withLanguageCodes(@Nullable List languageCode return this; } - /** * Optional. The granularity of timestamps to include in the transcription output. * Supported values: "word". If empty, no timestamps are generated. @@ -193,7 +187,6 @@ public TranscriptionConfig withTimestampGranularities(@Nullable List tim return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -203,33 +196,37 @@ public boolean equals(java.lang.Object o) { return false; } TranscriptionConfig other = (TranscriptionConfig) o; - return - Utils.enhancedDeepEquals(this.adaptationPhrases, other.adaptationPhrases) && - Utils.enhancedDeepEquals(this.customVocabulary, other.customVocabulary) && - Utils.enhancedDeepEquals(this.diarizationMode, other.diarizationMode) && - Utils.enhancedDeepEquals(this.languageCodes, other.languageCodes) && - Utils.enhancedDeepEquals(this.timestampGranularities, other.timestampGranularities); + return Utils.enhancedDeepEquals(this.adaptationPhrases, other.adaptationPhrases) + && Utils.enhancedDeepEquals(this.customVocabulary, other.customVocabulary) + && Utils.enhancedDeepEquals(this.diarizationMode, other.diarizationMode) + && Utils.enhancedDeepEquals(this.languageCodes, other.languageCodes) + && Utils.enhancedDeepEquals(this.timestampGranularities, other.timestampGranularities); } - + @Override public int hashCode() { return Utils.enhancedHash( - adaptationPhrases, customVocabulary, diarizationMode, - languageCodes, timestampGranularities); + adaptationPhrases, customVocabulary, diarizationMode, languageCodes, timestampGranularities); } - + @Override public String toString() { - return Utils.toString(TranscriptionConfig.class, - "adaptationPhrases", adaptationPhrases, - "customVocabulary", customVocabulary, - "diarizationMode", diarizationMode, - "languageCodes", languageCodes, - "timestampGranularities", timestampGranularities); + return Utils.toString( + TranscriptionConfig.class, + "adaptationPhrases", + adaptationPhrases, + "customVocabulary", + customVocabulary, + "diarizationMode", + diarizationMode, + "languageCodes", + languageCodes, + "timestampGranularities", + timestampGranularities); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { @Deprecated private List adaptationPhrases; @@ -243,12 +240,12 @@ public final static class Builder { private List timestampGranularities; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** * Optional. A list of phrases to bias the ASR model towards. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -294,9 +291,7 @@ public Builder timestampGranularities(@Nullable List timestampGranularit public TranscriptionConfig build() { return new TranscriptionConfig( - adaptationPhrases, customVocabulary, diarizationMode, - languageCodes, timestampGranularities); + adaptationPhrases, customVocabulary, diarizationMode, languageCodes, timestampGranularities); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/TranscriptionMode.java b/src/main/java/com/google/genai/gaos/models/interactions/TranscriptionMode.java new file mode 100644 index 00000000000..621e7abec70 --- /dev/null +++ b/src/main/java/com/google/genai/gaos/models/interactions/TranscriptionMode.java @@ -0,0 +1,146 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.google.genai.gaos.models.interactions; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.lang.Override; +import java.lang.String; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +/** + * Wrapper for an "open" enum that can handle unknown values from API responses + * without runtime errors. Instances are immutable singletons with reference equality. + * Use {@code asEnum()} for switch expressions. + */ +/** + * TranscriptionMode + * + *

Configures transcription mode. Supported values: `VERBATIM`, `SMART`. If + * unspecified, defaults to `VERBATIM` transcription. Mutually exclusive with + * `timestamp_granularities` and `diarization_mode`. + */ +public class TranscriptionMode { + + public static final TranscriptionMode VERBATIM = new TranscriptionMode("verbatim"); + public static final TranscriptionMode SMART = new TranscriptionMode("smart"); + + // This map will grow whenever a Color gets created with a new + // unrecognized value (a potential memory leak if the user is not + // careful). Keep this field lower case to avoid clashing with + // generated member names which will always be upper cased (Java + // convention) + private static final Map values = createValuesMap(); + private static final Map enums = createEnumsMap(); + + private final String value; + + private TranscriptionMode(String value) { + this.value = value; + } + + /** + * Returns a TranscriptionMode with the given value. For a specific value the + * returned object will always be a singleton so reference equality + * is satisfied when the values are the same. + * + * @param value value to be wrapped as TranscriptionMode + */ + @JsonCreator + public static TranscriptionMode of(String value) { + synchronized (TranscriptionMode.class) { + return values.computeIfAbsent(value, v -> new TranscriptionMode(v)); + } + } + + @JsonValue + public String value() { + return value; + } + + public Optional asEnum() { + return Optional.ofNullable(enums.getOrDefault(value, null)); + } + + public boolean isKnown() { + return asEnum().isPresent(); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + TranscriptionMode other = (TranscriptionMode) obj; + return Objects.equals(value, other.value); + } + + @Override + public String toString() { + return "TranscriptionMode [value=" + value + "]"; + } + + // return an array just like an enum + public static TranscriptionMode[] values() { + synchronized (TranscriptionMode.class) { + return values.values().toArray(new TranscriptionMode[] {}); + } + } + + private static final Map createValuesMap() { + Map map = new LinkedHashMap<>(); + map.put("verbatim", VERBATIM); + map.put("smart", SMART); + return map; + } + + private static final Map createEnumsMap() { + Map map = new HashMap<>(); + map.put("verbatim", TranscriptionModeEnum.VERBATIM); + map.put("smart", TranscriptionModeEnum.SMART); + return map; + } + + public enum TranscriptionModeEnum { + + VERBATIM("verbatim"), + SMART("smart"), + ; + + private final String value; + + private TranscriptionModeEnum(String value) { + this.value = value; + } + + public String value() { + return value; + } + } +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Transform.java b/src/main/java/com/google/genai/gaos/models/interactions/Transform.java index 028c0a3e168..7a4e216d732 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Transform.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Transform.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -37,7 +37,7 @@ /** * Transform - * + * *

Headers to inject on all outbound requests matching this domain. Accepts a single dict or a list of * dicts. The egress proxy injects these automatically. */ @@ -46,21 +46,22 @@ public class Transform { @JsonValue private final TypedObject value; - + private Transform(TypedObject value) { this.value = value; } public static Transform of(Map value) { Utils.checkNotNull(value, "value"); - return new Transform(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new Transform(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>() {})); } public static Transform of(List> value) { Utils.checkNotNull(value, "value"); - return new Transform(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>>(){})); + return new Transform( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>>() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code Map}, * otherwise returns an empty {@link Optional}. @@ -74,7 +75,7 @@ public Optional> mapOfString() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code List>}, * otherwise returns an empty {@link Optional}. @@ -88,19 +89,19 @@ public Optional>> arrayOfMap() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -112,27 +113,26 @@ public boolean equals(java.lang.Object o) { Transform other = (Transform) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(Transform.class, false, - TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference>>() {}, JsonShape.DEFAULT)); + super( + Transform.class, + false, + TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference>>() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(Transform.class, - "value", value); + return Utils.toString(Transform.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Turn.java b/src/main/java/com/google/genai/gaos/models/interactions/Turn.java deleted file mode 100644 index 704d07ce421..00000000000 --- a/src/main/java/com/google/genai/gaos/models/interactions/Turn.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright 2026 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.google.genai.gaos.models.interactions; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.genai.gaos.utils.Utils; -import jakarta.annotation.Nullable; -import java.lang.Deprecated; -import java.lang.Override; -import java.lang.String; -import java.util.Optional; - -/** - * Turn - * - * @deprecated class: This will be removed in a future release, please migrate away from it as soon as possible. - */ -@Deprecated -public class Turn { - - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("content") - private TurnContent content; - - /** - * The originator of this turn. Must be user for input or model for - * model output. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("role") - private String role; - - @JsonCreator - public Turn( - @JsonProperty("content") @Nullable TurnContent content, - @JsonProperty("role") @Nullable String role) { - this.content = content; - this.role = role; - } - - public Turn() { - this(null, null); - } - - public Optional content() { - return Optional.ofNullable(this.content); - } - - /** - * The originator of this turn. Must be user for input or model for - * model output. - */ - public Optional role() { - return Optional.ofNullable(this.role); - } - - public static Builder builder() { - return new Builder(); - } - - - public Turn withContent(@Nullable TurnContent content) { - this.content = content; - return this; - } - - - /** - * The originator of this turn. Must be user for input or model for - * model output. - */ - public Turn withRole(@Nullable String role) { - this.role = role; - return this; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Turn other = (Turn) o; - return - Utils.enhancedDeepEquals(this.content, other.content) && - Utils.enhancedDeepEquals(this.role, other.role); - } - - @Override - public int hashCode() { - return Utils.enhancedHash( - content, role); - } - - @Override - public String toString() { - return Utils.toString(Turn.class, - "content", content, - "role", role); - } - - @SuppressWarnings("UnusedReturnValue") - public final static class Builder { - - private TurnContent content; - - private String role; - - private Builder() { - // force use of static builder() method - } - - public Builder content(@Nullable TurnContent content) { - this.content = content; - return this; - } - - /** - * The originator of this turn. Must be user for input or model for - * model output. - */ - public Builder role(@Nullable String role) { - this.role = role; - return this; - } - - public Turn build() { - return new Turn( - content, role); - } - - } -} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/URLCitation.java b/src/main/java/com/google/genai/gaos/models/interactions/URLCitation.java index 2cf17c246c7..302fa6214b0 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/URLCitation.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/URLCitation.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * URLCitation - * + * *

A URL citation annotation. */ public class URLCitation implements Annotation { @@ -47,7 +47,7 @@ public class URLCitation implements Annotation { /** * Start of segment of the response that is attributed to this source. - * + * *

Index indicates the start of the segment, measured in bytes. */ @JsonInclude(Include.NON_ABSENT) @@ -61,7 +61,6 @@ public class URLCitation implements Annotation { @JsonProperty("title") private String title; - @JsonProperty("type") private String type; @@ -84,10 +83,9 @@ public URLCitation( this.type = Builder._SINGLETON_VALUE_Type.value(); this.url = url; } - + public URLCitation() { - this(null, null, null, - null); + this(null, null, null, null); } /** @@ -99,7 +97,7 @@ public Optional endIndex() { /** * Start of segment of the response that is attributed to this source. - * + * *

Index indicates the start of the segment, measured in bytes. */ public Optional startIndex() { @@ -129,7 +127,6 @@ public static Builder builder() { return new Builder(); } - /** * End of the attributed segment, exclusive. */ @@ -138,10 +135,9 @@ public URLCitation withEndIndex(@Nullable Integer endIndex) { return this; } - /** * Start of segment of the response that is attributed to this source. - * + * *

Index indicates the start of the segment, measured in bytes. */ public URLCitation withStartIndex(@Nullable Integer startIndex) { @@ -149,7 +145,6 @@ public URLCitation withStartIndex(@Nullable Integer startIndex) { return this; } - /** * The title of the URL. */ @@ -158,7 +153,6 @@ public URLCitation withTitle(@Nullable String title) { return this; } - /** * The URL. */ @@ -167,7 +161,6 @@ public URLCitation withUrl(@Nullable String url) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -177,33 +170,36 @@ public boolean equals(java.lang.Object o) { return false; } URLCitation other = (URLCitation) o; - return - Utils.enhancedDeepEquals(this.endIndex, other.endIndex) && - Utils.enhancedDeepEquals(this.startIndex, other.startIndex) && - Utils.enhancedDeepEquals(this.title, other.title) && - Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.url, other.url); + return Utils.enhancedDeepEquals(this.endIndex, other.endIndex) + && Utils.enhancedDeepEquals(this.startIndex, other.startIndex) + && Utils.enhancedDeepEquals(this.title, other.title) + && Utils.enhancedDeepEquals(this.type, other.type) + && Utils.enhancedDeepEquals(this.url, other.url); } - + @Override public int hashCode() { - return Utils.enhancedHash( - endIndex, startIndex, title, - type, url); + return Utils.enhancedHash(endIndex, startIndex, title, type, url); } - + @Override public String toString() { - return Utils.toString(URLCitation.class, - "endIndex", endIndex, - "startIndex", startIndex, - "title", title, - "type", type, - "url", url); + return Utils.toString( + URLCitation.class, + "endIndex", + endIndex, + "startIndex", + startIndex, + "title", + title, + "type", + type, + "url", + url); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Integer endIndex; @@ -214,7 +210,7 @@ public final static class Builder { private String url; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -227,7 +223,7 @@ public Builder endIndex(@Nullable Integer endIndex) { /** * Start of segment of the response that is attributed to this source. - * + * *

Index indicates the start of the segment, measured in bytes. */ public Builder startIndex(@Nullable Integer startIndex) { @@ -252,16 +248,10 @@ public Builder url(@Nullable String url) { } public URLCitation build() { - return new URLCitation( - endIndex, startIndex, title, - url); + return new URLCitation(endIndex, startIndex, title, url); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"url_citation\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"url_citation\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/URLContext.java b/src/main/java/com/google/genai/gaos/models/interactions/URLContext.java index ed2e487317f..f2dba5f5d61 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/URLContext.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/URLContext.java @@ -30,7 +30,7 @@ /** * URLContext - * + * *

A tool that can be used by the model to fetch URL context. */ public class URLContext implements Tool, AgentTool { @@ -52,7 +52,6 @@ public static Builder builder() { return new Builder(); } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -62,39 +61,31 @@ public boolean equals(java.lang.Object o) { return false; } URLContext other = (URLContext) o; - return - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - type); + return Utils.enhancedHash(type); } - + @Override public String toString() { - return Utils.toString(URLContext.class, - "type", type); + return Utils.toString(URLContext.class, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Builder() { - // force use of static builder() method + // force use of static builder() method } public URLContext build() { - return new URLContext( - ); + return new URLContext(); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"url_context\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"url_context\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/URLContextCallArguments.java b/src/main/java/com/google/genai/gaos/models/interactions/URLContextCallArguments.java index 194fd401b45..e727b7a8dff 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/URLContextCallArguments.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/URLContextCallArguments.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * URLContextCallArguments - * + * *

The arguments to pass to the URL context. */ public class URLContextCallArguments { @@ -44,11 +44,10 @@ public class URLContextCallArguments { private List urls; @JsonCreator - public URLContextCallArguments( - @JsonProperty("urls") @Nullable List urls) { + public URLContextCallArguments(@JsonProperty("urls") @Nullable List urls) { this.urls = urls; } - + public URLContextCallArguments() { this(null); } @@ -64,7 +63,6 @@ public static Builder builder() { return new Builder(); } - /** * The URLs to fetch. */ @@ -73,7 +71,6 @@ public URLContextCallArguments withUrls(@Nullable List urls) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -83,29 +80,26 @@ public boolean equals(java.lang.Object o) { return false; } URLContextCallArguments other = (URLContextCallArguments) o; - return - Utils.enhancedDeepEquals(this.urls, other.urls); + return Utils.enhancedDeepEquals(this.urls, other.urls); } - + @Override public int hashCode() { - return Utils.enhancedHash( - urls); + return Utils.enhancedHash(urls); } - + @Override public String toString() { - return Utils.toString(URLContextCallArguments.class, - "urls", urls); + return Utils.toString(URLContextCallArguments.class, "urls", urls); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List urls; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -117,9 +111,7 @@ public Builder urls(@Nullable List urls) { } public URLContextCallArguments build() { - return new URLContextCallArguments( - urls); + return new URLContextCallArguments(urls); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/URLContextCallDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/URLContextCallDelta.java index 5ef0265b5ee..d8a66eb6584 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/URLContextCallDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/URLContextCallDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -32,7 +32,6 @@ import java.lang.String; import java.util.Optional; - public class URLContextCallDelta implements StepDeltaData { /** * The arguments to pass to the URL context. @@ -47,7 +46,6 @@ public class URLContextCallDelta implements StepDeltaData { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -56,13 +54,12 @@ public URLContextCallDelta( @JsonProperty("arguments") @Nonnull URLContextCallArguments arguments, @JsonProperty("signature") @Nullable String signature) { this.arguments = Optional.ofNullable(arguments) - .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public URLContextCallDelta( - @Nonnull URLContextCallArguments arguments) { + + public URLContextCallDelta(@Nonnull URLContextCallArguments arguments) { this(arguments, null); } @@ -89,7 +86,6 @@ public static Builder builder() { return new Builder(); } - /** * The arguments to pass to the URL context. */ @@ -98,7 +94,6 @@ public URLContextCallDelta withArguments(@Nonnull URLContextCallArguments argume return this; } - /** * A signature hash for backend validation. */ @@ -107,7 +102,6 @@ public URLContextCallDelta withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -117,35 +111,30 @@ public boolean equals(java.lang.Object o) { return false; } URLContextCallDelta other = (URLContextCallDelta) o; - return - Utils.enhancedDeepEquals(this.arguments, other.arguments) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.arguments, other.arguments) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - arguments, signature, type); + return Utils.enhancedHash(arguments, signature, type); } - + @Override public String toString() { - return Utils.toString(URLContextCallDelta.class, - "arguments", arguments, - "signature", signature, - "type", type); + return Utils.toString(URLContextCallDelta.class, "arguments", arguments, "signature", signature, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private URLContextCallArguments arguments; private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -165,15 +154,10 @@ public Builder signature(@Nullable String signature) { } public URLContextCallDelta build() { - return new URLContextCallDelta( - arguments, signature); + return new URLContextCallDelta(arguments, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"url_context_call\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"url_context_call\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/URLContextCallStep.java b/src/main/java/com/google/genai/gaos/models/interactions/URLContextCallStep.java index 8712ee9aaab..8744ff2cb31 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/URLContextCallStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/URLContextCallStep.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * URLContextCallStep - * + * *

URL context call step. */ public class URLContextCallStep implements Step { @@ -57,7 +57,6 @@ public class URLContextCallStep implements Step { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -67,16 +66,13 @@ public URLContextCallStep( @JsonProperty("id") @Nonnull String id, @JsonProperty("signature") @Nullable String signature) { this.arguments = Optional.ofNullable(arguments) - .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("arguments cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public URLContextCallStep( - @Nonnull URLContextCallArguments arguments, - @Nonnull String id) { + + public URLContextCallStep(@Nonnull URLContextCallArguments arguments, @Nonnull String id) { this(arguments, id, null); } @@ -110,7 +106,6 @@ public static Builder builder() { return new Builder(); } - /** * The arguments to pass to the URL context. */ @@ -119,7 +114,6 @@ public URLContextCallStep withArguments(@Nonnull URLContextCallArguments argumen return this; } - /** * Required. A unique ID for this specific tool call. */ @@ -128,7 +122,6 @@ public URLContextCallStep withId(@Nonnull String id) { return this; } - /** * A signature hash for backend validation. */ @@ -137,7 +130,6 @@ public URLContextCallStep withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -147,31 +139,25 @@ public boolean equals(java.lang.Object o) { return false; } URLContextCallStep other = (URLContextCallStep) o; - return - Utils.enhancedDeepEquals(this.arguments, other.arguments) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.arguments, other.arguments) + && Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - arguments, id, signature, - type); + return Utils.enhancedHash(arguments, id, signature, type); } - + @Override public String toString() { - return Utils.toString(URLContextCallStep.class, - "arguments", arguments, - "id", id, - "signature", signature, - "type", type); + return Utils.toString( + URLContextCallStep.class, "arguments", arguments, "id", id, "signature", signature, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private URLContextCallArguments arguments; @@ -180,7 +166,7 @@ public final static class Builder { private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -208,15 +194,10 @@ public Builder signature(@Nullable String signature) { } public URLContextCallStep build() { - return new URLContextCallStep( - arguments, id, signature); + return new URLContextCallStep(arguments, id, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"url_context_call\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"url_context_call\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/URLContextResult.java b/src/main/java/com/google/genai/gaos/models/interactions/URLContextResult.java index 2e67a3c92a1..7a93a157596 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/URLContextResult.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/URLContextResult.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -31,7 +31,7 @@ /** * URLContextResult - * + * *

The result of the URL context. */ public class URLContextResult { @@ -56,7 +56,7 @@ public URLContextResult( this.status = status; this.url = url; } - + public URLContextResult() { this(null, null); } @@ -79,7 +79,6 @@ public static Builder builder() { return new Builder(); } - /** * The status of the URL retrieval. */ @@ -88,7 +87,6 @@ public URLContextResult withStatus(@Nullable URLContextResultStatus status) { return this; } - /** * The URL that was fetched. */ @@ -97,7 +95,6 @@ public URLContextResult withUrl(@Nullable String url) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -107,33 +104,28 @@ public boolean equals(java.lang.Object o) { return false; } URLContextResult other = (URLContextResult) o; - return - Utils.enhancedDeepEquals(this.status, other.status) && - Utils.enhancedDeepEquals(this.url, other.url); + return Utils.enhancedDeepEquals(this.status, other.status) && Utils.enhancedDeepEquals(this.url, other.url); } - + @Override public int hashCode() { - return Utils.enhancedHash( - status, url); + return Utils.enhancedHash(status, url); } - + @Override public String toString() { - return Utils.toString(URLContextResult.class, - "status", status, - "url", url); + return Utils.toString(URLContextResult.class, "status", status, "url", url); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private URLContextResultStatus status; private String url; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -153,9 +145,7 @@ public Builder url(@Nullable String url) { } public URLContextResult build() { - return new URLContextResult( - status, url); + return new URLContextResult(status, url); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/URLContextResultDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/URLContextResultDelta.java index 385a8c5e103..82aaee0f341 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/URLContextResultDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/URLContextResultDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,14 +34,12 @@ import java.util.List; import java.util.Optional; - public class URLContextResultDelta implements StepDeltaData { @JsonInclude(Include.NON_ABSENT) @JsonProperty("is_error") private Boolean isError; - @JsonProperty("result") private List result; @@ -52,7 +50,6 @@ public class URLContextResultDelta implements StepDeltaData { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -62,14 +59,13 @@ public URLContextResultDelta( @JsonProperty("result") @Nonnull List result, @JsonProperty("signature") @Nullable String signature) { this.isError = isError; - this.result = Optional.ofNullable(result) - .orElseThrow(() -> new IllegalArgumentException("result cannot be null")); + this.result = + Optional.ofNullable(result).orElseThrow(() -> new IllegalArgumentException("result cannot be null")); this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public URLContextResultDelta( - @Nonnull List result) { + + public URLContextResultDelta(@Nonnull List result) { this(null, result, null); } @@ -97,19 +93,16 @@ public static Builder builder() { return new Builder(); } - public URLContextResultDelta withIsError(@Nullable Boolean isError) { this.isError = isError; return this; } - public URLContextResultDelta withResult(@Nonnull List result) { this.result = Utils.checkNotNull(result, "result"); return this; } - /** * A signature hash for backend validation. */ @@ -118,7 +111,6 @@ public URLContextResultDelta withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -128,31 +120,33 @@ public boolean equals(java.lang.Object o) { return false; } URLContextResultDelta other = (URLContextResultDelta) o; - return - Utils.enhancedDeepEquals(this.isError, other.isError) && - Utils.enhancedDeepEquals(this.result, other.result) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.isError, other.isError) + && Utils.enhancedDeepEquals(this.result, other.result) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - isError, result, signature, - type); + return Utils.enhancedHash(isError, result, signature, type); } - + @Override public String toString() { - return Utils.toString(URLContextResultDelta.class, - "isError", isError, - "result", result, - "signature", signature, - "type", type); + return Utils.toString( + URLContextResultDelta.class, + "isError", + isError, + "result", + result, + "signature", + signature, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Boolean isError; @@ -161,7 +155,7 @@ public final static class Builder { private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder isError(@Nullable Boolean isError) { @@ -183,15 +177,10 @@ public Builder signature(@Nullable String signature) { } public URLContextResultDelta build() { - return new URLContextResultDelta( - isError, result, signature); + return new URLContextResultDelta(isError, result, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"url_context_result\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"url_context_result\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/URLContextResultStatus.java b/src/main/java/com/google/genai/gaos/models/interactions/URLContextResultStatus.java index d4231a0d5e3..e13ac7390ab 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/URLContextResultStatus.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/URLContextResultStatus.java @@ -36,7 +36,7 @@ */ /** * URLContextResultStatus - * + * *

The status of the URL retrieval. */ public class URLContextResultStatus { @@ -61,12 +61,12 @@ private URLContextResultStatus(String value) { } /** - * Returns a URLContextResultStatus with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a URLContextResultStatus with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as URLContextResultStatus - */ + */ @JsonCreator public static URLContextResultStatus of(String value) { synchronized (URLContextResultStatus.class) { @@ -94,12 +94,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; URLContextResultStatus other = (URLContextResultStatus) obj; return Objects.equals(value, other.value); } @@ -133,14 +130,14 @@ private static final Map createEnumsMap() { map.put("unsafe", URLContextResultStatusEnum.UNSAFE); return map; } - - + public enum URLContextResultStatusEnum { SUCCESS("success"), ERROR("error"), PAYWALL("paywall"), - UNSAFE("unsafe"),; + UNSAFE("unsafe"), + ; private final String value; @@ -153,4 +150,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/URLContextResultStep.java b/src/main/java/com/google/genai/gaos/models/interactions/URLContextResultStep.java index 9f33a197e32..1b0e5b81e7c 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/URLContextResultStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/URLContextResultStep.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -36,7 +36,7 @@ /** * URLContextResultStep - * + * *

URL context result step. */ public class URLContextResultStep implements Step { @@ -66,7 +66,6 @@ public class URLContextResultStep implements Step { @JsonProperty("signature") private String signature; - @JsonProperty("type") private String type; @@ -76,20 +75,17 @@ public URLContextResultStep( @JsonProperty("is_error") @Nullable Boolean isError, @JsonProperty("result") @Nonnull List result, @JsonProperty("signature") @Nullable String signature) { - this.callId = Optional.ofNullable(callId) - .orElseThrow(() -> new IllegalArgumentException("callId cannot be null")); + this.callId = + Optional.ofNullable(callId).orElseThrow(() -> new IllegalArgumentException("callId cannot be null")); this.isError = isError; - this.result = Optional.ofNullable(result) - .orElseThrow(() -> new IllegalArgumentException("result cannot be null")); + this.result = + Optional.ofNullable(result).orElseThrow(() -> new IllegalArgumentException("result cannot be null")); this.signature = signature; this.type = Builder._SINGLETON_VALUE_Type.value(); } - - public URLContextResultStep( - @Nonnull String callId, - @Nonnull List result) { - this(callId, null, result, - null); + + public URLContextResultStep(@Nonnull String callId, @Nonnull List result) { + this(callId, null, result, null); } /** @@ -129,7 +125,6 @@ public static Builder builder() { return new Builder(); } - /** * Required. ID to match the ID from the function call block. */ @@ -138,7 +133,6 @@ public URLContextResultStep withCallId(@Nonnull String callId) { return this; } - /** * Whether the URL context resulted in an error. */ @@ -147,7 +141,6 @@ public URLContextResultStep withIsError(@Nullable Boolean isError) { return this; } - /** * Required. The results of the URL context. */ @@ -156,7 +149,6 @@ public URLContextResultStep withResult(@Nonnull List result) { return this; } - /** * A signature hash for backend validation. */ @@ -165,7 +157,6 @@ public URLContextResultStep withSignature(@Nullable String signature) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -175,33 +166,36 @@ public boolean equals(java.lang.Object o) { return false; } URLContextResultStep other = (URLContextResultStep) o; - return - Utils.enhancedDeepEquals(this.callId, other.callId) && - Utils.enhancedDeepEquals(this.isError, other.isError) && - Utils.enhancedDeepEquals(this.result, other.result) && - Utils.enhancedDeepEquals(this.signature, other.signature) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.callId, other.callId) + && Utils.enhancedDeepEquals(this.isError, other.isError) + && Utils.enhancedDeepEquals(this.result, other.result) + && Utils.enhancedDeepEquals(this.signature, other.signature) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - callId, isError, result, - signature, type); + return Utils.enhancedHash(callId, isError, result, signature, type); } - + @Override public String toString() { - return Utils.toString(URLContextResultStep.class, - "callId", callId, - "isError", isError, - "result", result, - "signature", signature, - "type", type); + return Utils.toString( + URLContextResultStep.class, + "callId", + callId, + "isError", + isError, + "result", + result, + "signature", + signature, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String callId; @@ -212,7 +206,7 @@ public final static class Builder { private String signature; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -248,16 +242,10 @@ public Builder signature(@Nullable String signature) { } public URLContextResultStep build() { - return new URLContextResultStep( - callId, isError, result, - signature); + return new URLContextResultStep(callId, isError, result, signature); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"url_context_result\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"url_context_result\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/UnknownAnnotation.java b/src/main/java/com/google/genai/gaos/models/interactions/UnknownAnnotation.java index ecd2b2d601e..407340a020f 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/UnknownAnnotation.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/UnknownAnnotation.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; @@ -26,10 +25,9 @@ import java.lang.Override; import java.lang.String; - /** * UnknownAnnotation - * + * *

Citation information for model-generated content. */ public class UnknownAnnotation extends UnknownType implements Annotation { @@ -43,5 +41,4 @@ public UnknownAnnotation(JsonNode rawNode) { public String type() { return extractDiscriminator("type").orElse("UNKNOWN"); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/UnknownContent.java b/src/main/java/com/google/genai/gaos/models/interactions/UnknownContent.java index 8e0ad7265a1..f7b25431849 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/UnknownContent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/UnknownContent.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; @@ -26,10 +25,9 @@ import java.lang.Override; import java.lang.String; - /** * UnknownContent - * + * *

The content of the response. */ public class UnknownContent extends UnknownType implements Content { @@ -43,5 +41,4 @@ public UnknownContent(JsonNode rawNode) { public String type() { return extractDiscriminator("type").orElse("UNKNOWN"); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/UnknownCreateAgentInteractionAgentConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/UnknownCreateAgentInteractionAgentConfig.java index 71d4734f508..861d7e4a3ab 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/UnknownCreateAgentInteractionAgentConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/UnknownCreateAgentInteractionAgentConfig.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; @@ -26,10 +25,9 @@ import java.lang.Override; import java.lang.String; - /** * UnknownCreateAgentInteractionAgentConfig - * + * *

Configuration parameters for the agent interaction. */ public class UnknownCreateAgentInteractionAgentConfig extends UnknownType implements CreateAgentInteractionAgentConfig { @@ -43,5 +41,4 @@ public UnknownCreateAgentInteractionAgentConfig(JsonNode rawNode) { public String type() { return extractDiscriminator("type").orElse("UNKNOWN"); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/UnknownFunctionResultSubcontent.java b/src/main/java/com/google/genai/gaos/models/interactions/UnknownFunctionResultSubcontent.java index 11890988659..d6a70ac3828 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/UnknownFunctionResultSubcontent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/UnknownFunctionResultSubcontent.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; @@ -26,7 +25,6 @@ import java.lang.Override; import java.lang.String; - public class UnknownFunctionResultSubcontent extends UnknownType implements FunctionResultSubcontent { @JsonCreator @@ -38,5 +36,4 @@ public UnknownFunctionResultSubcontent(JsonNode rawNode) { public String type() { return extractDiscriminator("type").orElse("UNKNOWN"); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/UnknownInteractionAgentConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/UnknownInteractionAgentConfig.java index 8447a6fd56d..9458994308b 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/UnknownInteractionAgentConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/UnknownInteractionAgentConfig.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; @@ -26,10 +25,9 @@ import java.lang.Override; import java.lang.String; - /** * UnknownInteractionAgentConfig - * + * *

Configuration parameters for the agent interaction. */ public class UnknownInteractionAgentConfig extends UnknownType implements InteractionAgentConfig { @@ -43,5 +41,4 @@ public UnknownInteractionAgentConfig(JsonNode rawNode) { public String type() { return extractDiscriminator("type").orElse("UNKNOWN"); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/UnknownInteractionSSEEvent.java b/src/main/java/com/google/genai/gaos/models/interactions/UnknownInteractionSSEEvent.java index 6271844be96..2c762ccf9a3 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/UnknownInteractionSSEEvent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/UnknownInteractionSSEEvent.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; @@ -26,7 +25,6 @@ import java.lang.Override; import java.lang.String; - public class UnknownInteractionSSEEvent extends UnknownType implements InteractionSSEEvent { @JsonCreator @@ -38,5 +36,4 @@ public UnknownInteractionSSEEvent(JsonNode rawNode) { public String eventType() { return extractDiscriminator("event_type").orElse("UNKNOWN"); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/UnknownStep.java b/src/main/java/com/google/genai/gaos/models/interactions/UnknownStep.java index 134323e56cf..4d9e9a36578 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/UnknownStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/UnknownStep.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; @@ -26,10 +25,9 @@ import java.lang.Override; import java.lang.String; - /** * UnknownStep - * + * *

A step in the interaction. */ public class UnknownStep extends UnknownType implements Step { @@ -43,5 +41,4 @@ public UnknownStep(JsonNode rawNode) { public String type() { return extractDiscriminator("type").orElse("UNKNOWN"); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/UnknownStepDeltaData.java b/src/main/java/com/google/genai/gaos/models/interactions/UnknownStepDeltaData.java index 30ae71a6d11..34a141ebf9e 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/UnknownStepDeltaData.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/UnknownStepDeltaData.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; @@ -26,7 +25,6 @@ import java.lang.Override; import java.lang.String; - public class UnknownStepDeltaData extends UnknownType implements StepDeltaData { @JsonCreator @@ -38,5 +36,4 @@ public UnknownStepDeltaData(JsonNode rawNode) { public String type() { return extractDiscriminator("type").orElse("UNKNOWN"); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/UnknownThoughtSummaryContent.java b/src/main/java/com/google/genai/gaos/models/interactions/UnknownThoughtSummaryContent.java index e0aabfd4d01..9768b0c6cda 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/UnknownThoughtSummaryContent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/UnknownThoughtSummaryContent.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; @@ -26,7 +25,6 @@ import java.lang.Override; import java.lang.String; - public class UnknownThoughtSummaryContent extends UnknownType implements ThoughtSummaryContent { @JsonCreator @@ -38,5 +36,4 @@ public UnknownThoughtSummaryContent(JsonNode rawNode) { public String type() { return extractDiscriminator("type").orElse("UNKNOWN"); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/UnknownTool.java b/src/main/java/com/google/genai/gaos/models/interactions/UnknownTool.java index ce9870dd108..4b9f258bb30 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/UnknownTool.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/UnknownTool.java @@ -17,7 +17,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; @@ -26,10 +25,9 @@ import java.lang.Override; import java.lang.String; - /** * UnknownTool - * + * *

A tool that can be used by the model. */ public class UnknownTool extends UnknownType implements Tool { @@ -43,5 +41,4 @@ public UnknownTool(JsonNode rawNode) { public String type() { return extractDiscriminator("type").orElse("UNKNOWN"); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Usage.java b/src/main/java/com/google/genai/gaos/models/interactions/Usage.java index b77d7bd6fc7..60483b83f51 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Usage.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Usage.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -33,7 +33,7 @@ /** * Usage - * + * *

Statistics on the interaction request's token usage. */ public class Usage { @@ -140,12 +140,9 @@ public Usage( this.totalTokens = totalTokens; this.totalToolUseTokens = totalToolUseTokens; } - + public Usage() { - this(null, null, null, - null, null, null, - null, null, null, - null, null); + this(null, null, null, null, null, null, null, null, null, null, null); } /** @@ -230,7 +227,6 @@ public static Builder builder() { return new Builder(); } - /** * A breakdown of cached token usage by modality. */ @@ -239,7 +235,6 @@ public Usage withCachedTokensByModality(@Nullable List cachedTok return this; } - /** * Grounding tool count. */ @@ -248,7 +243,6 @@ public Usage withGroundingToolCount(@Nullable List grounding return this; } - /** * A breakdown of input token usage by modality. */ @@ -257,7 +251,6 @@ public Usage withInputTokensByModality(@Nullable List inputToken return this; } - /** * A breakdown of output token usage by modality. */ @@ -266,7 +259,6 @@ public Usage withOutputTokensByModality(@Nullable List outputTok return this; } - /** * A breakdown of tool-use token usage by modality. */ @@ -275,7 +267,6 @@ public Usage withToolUseTokensByModality(@Nullable List toolUseT return this; } - /** * Number of tokens in the cached part of the prompt (the cached content). */ @@ -284,7 +275,6 @@ public Usage withTotalCachedTokens(@Nullable Integer totalCachedTokens) { return this; } - /** * Number of tokens in the prompt (context). */ @@ -293,7 +283,6 @@ public Usage withTotalInputTokens(@Nullable Integer totalInputTokens) { return this; } - /** * Total number of tokens across all the generated responses. */ @@ -302,7 +291,6 @@ public Usage withTotalOutputTokens(@Nullable Integer totalOutputTokens) { return this; } - /** * Number of tokens of thoughts for thinking models. */ @@ -311,7 +299,6 @@ public Usage withTotalThoughtTokens(@Nullable Integer totalThoughtTokens) { return this; } - /** * Total token count for the interaction request (prompt + responses + other * internal tokens). @@ -321,7 +308,6 @@ public Usage withTotalTokens(@Nullable Integer totalTokens) { return this; } - /** * Number of tokens present in tool-use prompt(s). */ @@ -330,7 +316,6 @@ public Usage withTotalToolUseTokens(@Nullable Integer totalToolUseTokens) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -340,47 +325,65 @@ public boolean equals(java.lang.Object o) { return false; } Usage other = (Usage) o; - return - Utils.enhancedDeepEquals(this.cachedTokensByModality, other.cachedTokensByModality) && - Utils.enhancedDeepEquals(this.groundingToolCount, other.groundingToolCount) && - Utils.enhancedDeepEquals(this.inputTokensByModality, other.inputTokensByModality) && - Utils.enhancedDeepEquals(this.outputTokensByModality, other.outputTokensByModality) && - Utils.enhancedDeepEquals(this.toolUseTokensByModality, other.toolUseTokensByModality) && - Utils.enhancedDeepEquals(this.totalCachedTokens, other.totalCachedTokens) && - Utils.enhancedDeepEquals(this.totalInputTokens, other.totalInputTokens) && - Utils.enhancedDeepEquals(this.totalOutputTokens, other.totalOutputTokens) && - Utils.enhancedDeepEquals(this.totalThoughtTokens, other.totalThoughtTokens) && - Utils.enhancedDeepEquals(this.totalTokens, other.totalTokens) && - Utils.enhancedDeepEquals(this.totalToolUseTokens, other.totalToolUseTokens); + return Utils.enhancedDeepEquals(this.cachedTokensByModality, other.cachedTokensByModality) + && Utils.enhancedDeepEquals(this.groundingToolCount, other.groundingToolCount) + && Utils.enhancedDeepEquals(this.inputTokensByModality, other.inputTokensByModality) + && Utils.enhancedDeepEquals(this.outputTokensByModality, other.outputTokensByModality) + && Utils.enhancedDeepEquals(this.toolUseTokensByModality, other.toolUseTokensByModality) + && Utils.enhancedDeepEquals(this.totalCachedTokens, other.totalCachedTokens) + && Utils.enhancedDeepEquals(this.totalInputTokens, other.totalInputTokens) + && Utils.enhancedDeepEquals(this.totalOutputTokens, other.totalOutputTokens) + && Utils.enhancedDeepEquals(this.totalThoughtTokens, other.totalThoughtTokens) + && Utils.enhancedDeepEquals(this.totalTokens, other.totalTokens) + && Utils.enhancedDeepEquals(this.totalToolUseTokens, other.totalToolUseTokens); } - + @Override public int hashCode() { return Utils.enhancedHash( - cachedTokensByModality, groundingToolCount, inputTokensByModality, - outputTokensByModality, toolUseTokensByModality, totalCachedTokens, - totalInputTokens, totalOutputTokens, totalThoughtTokens, - totalTokens, totalToolUseTokens); + cachedTokensByModality, + groundingToolCount, + inputTokensByModality, + outputTokensByModality, + toolUseTokensByModality, + totalCachedTokens, + totalInputTokens, + totalOutputTokens, + totalThoughtTokens, + totalTokens, + totalToolUseTokens); } - + @Override public String toString() { - return Utils.toString(Usage.class, - "cachedTokensByModality", cachedTokensByModality, - "groundingToolCount", groundingToolCount, - "inputTokensByModality", inputTokensByModality, - "outputTokensByModality", outputTokensByModality, - "toolUseTokensByModality", toolUseTokensByModality, - "totalCachedTokens", totalCachedTokens, - "totalInputTokens", totalInputTokens, - "totalOutputTokens", totalOutputTokens, - "totalThoughtTokens", totalThoughtTokens, - "totalTokens", totalTokens, - "totalToolUseTokens", totalToolUseTokens); + return Utils.toString( + Usage.class, + "cachedTokensByModality", + cachedTokensByModality, + "groundingToolCount", + groundingToolCount, + "inputTokensByModality", + inputTokensByModality, + "outputTokensByModality", + outputTokensByModality, + "toolUseTokensByModality", + toolUseTokensByModality, + "totalCachedTokens", + totalCachedTokens, + "totalInputTokens", + totalInputTokens, + "totalOutputTokens", + totalOutputTokens, + "totalThoughtTokens", + totalThoughtTokens, + "totalTokens", + totalTokens, + "totalToolUseTokens", + totalToolUseTokens); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List cachedTokensByModality; @@ -405,7 +408,7 @@ public final static class Builder { private Integer totalToolUseTokens; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -499,11 +502,17 @@ public Builder totalToolUseTokens(@Nullable Integer totalToolUseTokens) { public Usage build() { return new Usage( - cachedTokensByModality, groundingToolCount, inputTokensByModality, - outputTokensByModality, toolUseTokensByModality, totalCachedTokens, - totalInputTokens, totalOutputTokens, totalThoughtTokens, - totalTokens, totalToolUseTokens); + cachedTokensByModality, + groundingToolCount, + inputTokensByModality, + outputTokensByModality, + toolUseTokensByModality, + totalCachedTokens, + totalInputTokens, + totalOutputTokens, + totalThoughtTokens, + totalTokens, + totalToolUseTokens); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/UserInputStep.java b/src/main/java/com/google/genai/gaos/models/interactions/UserInputStep.java index 219e6be80af..43bdf8edc3a 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/UserInputStep.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/UserInputStep.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * UserInputStep - * + * *

Input provided by the user. */ public class UserInputStep implements Step { @@ -43,17 +43,15 @@ public class UserInputStep implements Step { @JsonProperty("content") private List content; - @JsonProperty("type") private String type; @JsonCreator - public UserInputStep( - @JsonProperty("content") @Nullable List content) { + public UserInputStep(@JsonProperty("content") @Nullable List content) { this.content = content; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public UserInputStep() { this(null); } @@ -71,13 +69,11 @@ public static Builder builder() { return new Builder(); } - public UserInputStep withContent(@Nullable List content) { this.content = content; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -87,31 +83,26 @@ public boolean equals(java.lang.Object o) { return false; } UserInputStep other = (UserInputStep) o; - return - Utils.enhancedDeepEquals(this.content, other.content) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.content, other.content) && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - content, type); + return Utils.enhancedHash(content, type); } - + @Override public String toString() { - return Utils.toString(UserInputStep.class, - "content", content, - "type", type); + return Utils.toString(UserInputStep.class, "content", content, "type", type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List content; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder content(@Nullable List content) { @@ -120,15 +111,10 @@ public Builder content(@Nullable List content) { } public UserInputStep build() { - return new UserInputStep( - content); + return new UserInputStep(content); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"user_input\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"user_input\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/VertexAISearchConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/VertexAISearchConfig.java index a400ea31849..6b18d9e28e7 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/VertexAISearchConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/VertexAISearchConfig.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * VertexAISearchConfig - * + * *

Used to specify configuration for VertexAISearch. */ public class VertexAISearchConfig { @@ -57,7 +57,7 @@ public VertexAISearchConfig( this.datastores = datastores; this.engine = engine; } - + public VertexAISearchConfig() { this(null, null); } @@ -80,7 +80,6 @@ public static Builder builder() { return new Builder(); } - /** * Optional. Used to specify Vertex AI Search datastores. */ @@ -89,7 +88,6 @@ public VertexAISearchConfig withDatastores(@Nullable List datastores) { return this; } - /** * Optional. Used to specify Vertex AI Search engine. */ @@ -98,7 +96,6 @@ public VertexAISearchConfig withEngine(@Nullable String engine) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -108,33 +105,29 @@ public boolean equals(java.lang.Object o) { return false; } VertexAISearchConfig other = (VertexAISearchConfig) o; - return - Utils.enhancedDeepEquals(this.datastores, other.datastores) && - Utils.enhancedDeepEquals(this.engine, other.engine); + return Utils.enhancedDeepEquals(this.datastores, other.datastores) + && Utils.enhancedDeepEquals(this.engine, other.engine); } - + @Override public int hashCode() { - return Utils.enhancedHash( - datastores, engine); + return Utils.enhancedHash(datastores, engine); } - + @Override public String toString() { - return Utils.toString(VertexAISearchConfig.class, - "datastores", datastores, - "engine", engine); + return Utils.toString(VertexAISearchConfig.class, "datastores", datastores, "engine", engine); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List datastores; private String engine; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -154,9 +147,7 @@ public Builder engine(@Nullable String engine) { } public VertexAISearchConfig build() { - return new VertexAISearchConfig( - datastores, engine); + return new VertexAISearchConfig(datastores, engine); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/VideoConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/VideoConfig.java index 4e7f88b0cf0..4775ee46c03 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/VideoConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/VideoConfig.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -31,7 +31,7 @@ /** * VideoConfig - * + * *

Configuration options for video generation. */ public class VideoConfig { @@ -45,11 +45,10 @@ public class VideoConfig { private Task task; @JsonCreator - public VideoConfig( - @JsonProperty("task") @Nullable Task task) { + public VideoConfig(@JsonProperty("task") @Nullable Task task) { this.task = task; } - + public VideoConfig() { this(null); } @@ -67,7 +66,6 @@ public static Builder builder() { return new Builder(); } - /** * Optional task mode for video generation. If not specified, the model * automatically determines the appropriate mode based on the provided text @@ -78,7 +76,6 @@ public VideoConfig withTask(@Nullable Task task) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -88,29 +85,26 @@ public boolean equals(java.lang.Object o) { return false; } VideoConfig other = (VideoConfig) o; - return - Utils.enhancedDeepEquals(this.task, other.task); + return Utils.enhancedDeepEquals(this.task, other.task); } - + @Override public int hashCode() { - return Utils.enhancedHash( - task); + return Utils.enhancedHash(task); } - + @Override public String toString() { - return Utils.toString(VideoConfig.class, - "task", task); + return Utils.toString(VideoConfig.class, "task", task); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Task task; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -124,9 +118,7 @@ public Builder task(@Nullable Task task) { } public VideoConfig build() { - return new VideoConfig( - task); + return new VideoConfig(task); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/VideoContent.java b/src/main/java/com/google/genai/gaos/models/interactions/VideoContent.java index ea781a33a42..c09b08f6f63 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/VideoContent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/VideoContent.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -33,7 +33,7 @@ /** * VideoContent - * + * *

A video content block. */ public class VideoContent implements Content { @@ -44,12 +44,17 @@ public class VideoContent implements Content { @JsonProperty("data") private String data; + /** + * How the model processes this video for understanding. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("processing") + private Processing processing; @JsonInclude(Include.NON_ABSENT) @JsonProperty("resolution") private MediaResolution resolution; - @JsonProperty("type") private String type; @@ -70,19 +75,20 @@ public class VideoContent implements Content { @JsonCreator public VideoContent( @JsonProperty("data") @Nullable String data, + @JsonProperty("processing") @Nullable Processing processing, @JsonProperty("resolution") @Nullable MediaResolution resolution, @JsonProperty("uri") @Nullable String uri, @JsonProperty("mime_type") @Nullable VideoContentMimeType mimeType) { this.data = data; + this.processing = processing; this.resolution = resolution; this.type = Builder._SINGLETON_VALUE_Type.value(); this.uri = uri; this.mimeType = mimeType; } - + public VideoContent() { - this(null, null, null, - null); + this(null, null, null, null, null); } /** @@ -92,6 +98,13 @@ public Optional data() { return Optional.ofNullable(this.data); } + /** + * How the model processes this video for understanding. + */ + public Optional processing() { + return Optional.ofNullable(this.processing); + } + public Optional resolution() { return Optional.ofNullable(this.resolution); } @@ -119,7 +132,6 @@ public static Builder builder() { return new Builder(); } - /** * The video content. */ @@ -128,13 +140,19 @@ public VideoContent withData(@Nullable String data) { return this; } + /** + * How the model processes this video for understanding. + */ + public VideoContent withProcessing(@Nullable Processing processing) { + this.processing = processing; + return this; + } public VideoContent withResolution(@Nullable MediaResolution resolution) { this.resolution = resolution; return this; } - /** * The URI of the video. */ @@ -143,7 +161,6 @@ public VideoContent withUri(@Nullable String uri) { return this; } - /** * The mime type of the video. */ @@ -152,7 +169,6 @@ public VideoContent withMimeType(@Nullable VideoContentMimeType mimeType) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -162,36 +178,44 @@ public boolean equals(java.lang.Object o) { return false; } VideoContent other = (VideoContent) o; - return - Utils.enhancedDeepEquals(this.data, other.data) && - Utils.enhancedDeepEquals(this.resolution, other.resolution) && - Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.uri, other.uri) && - Utils.enhancedDeepEquals(this.mimeType, other.mimeType); - } - + return Utils.enhancedDeepEquals(this.data, other.data) + && Utils.enhancedDeepEquals(this.processing, other.processing) + && Utils.enhancedDeepEquals(this.resolution, other.resolution) + && Utils.enhancedDeepEquals(this.type, other.type) + && Utils.enhancedDeepEquals(this.uri, other.uri) + && Utils.enhancedDeepEquals(this.mimeType, other.mimeType); + } + @Override public int hashCode() { - return Utils.enhancedHash( - data, resolution, type, - uri, mimeType); + return Utils.enhancedHash(data, processing, resolution, type, uri, mimeType); } - + @Override public String toString() { - return Utils.toString(VideoContent.class, - "data", data, - "resolution", resolution, - "type", type, - "uri", uri, - "mimeType", mimeType); + return Utils.toString( + VideoContent.class, + "data", + data, + "processing", + processing, + "resolution", + resolution, + "type", + type, + "uri", + uri, + "mimeType", + mimeType); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String data; + private Processing processing; + private MediaResolution resolution; private String uri; @@ -199,7 +223,7 @@ public final static class Builder { private VideoContentMimeType mimeType; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -210,6 +234,14 @@ public Builder data(@Nullable String data) { return this; } + /** + * How the model processes this video for understanding. + */ + public Builder processing(@Nullable Processing processing) { + this.processing = processing; + return this; + } + public Builder resolution(@Nullable MediaResolution resolution) { this.resolution = resolution; return this; @@ -232,16 +264,10 @@ public Builder mimeType(@Nullable VideoContentMimeType mimeType) { } public VideoContent build() { - return new VideoContent( - data, resolution, uri, - mimeType); + return new VideoContent(data, processing, resolution, uri, mimeType); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"video\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"video\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/VideoContentMimeType.java b/src/main/java/com/google/genai/gaos/models/interactions/VideoContentMimeType.java index b7c7e393bcf..fe1fd8bf668 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/VideoContentMimeType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/VideoContentMimeType.java @@ -36,7 +36,7 @@ */ /** * VideoContentMimeType - * + * *

The mime type of the video. */ public class VideoContentMimeType { @@ -66,12 +66,12 @@ private VideoContentMimeType(String value) { } /** - * Returns a VideoContentMimeType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a VideoContentMimeType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as VideoContentMimeType - */ + */ @JsonCreator public static VideoContentMimeType of(String value) { synchronized (VideoContentMimeType.class) { @@ -99,12 +99,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; VideoContentMimeType other = (VideoContentMimeType) obj; return Objects.equals(value, other.value); } @@ -148,8 +145,7 @@ private static final Map createEnumsMap() { map.put("video/3gpp", VideoContentMimeTypeEnum.VIDEO3GPP); return map; } - - + public enum VideoContentMimeTypeEnum { VIDEO_MP4("video/mp4"), @@ -160,7 +156,8 @@ public enum VideoContentMimeTypeEnum { VIDEO_X_FLV("video/x-flv"), VIDEO_WEBM("video/webm"), VIDEO_WMV("video/wmv"), - VIDEO3GPP("video/3gpp"),; + VIDEO3GPP("video/3gpp"), + ; private final String value; @@ -173,4 +170,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/VideoDelta.java b/src/main/java/com/google/genai/gaos/models/interactions/VideoDelta.java index ad91118b926..c98b11baf7e 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/VideoDelta.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/VideoDelta.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -31,28 +31,23 @@ import java.lang.String; import java.util.Optional; - public class VideoDelta implements StepDeltaData { @JsonInclude(Include.NON_ABSENT) @JsonProperty("data") private String data; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("mime_type") private VideoDeltaMimeType mimeType; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("resolution") private MediaResolution resolution; - @JsonProperty("type") private String type; - @JsonInclude(Include.NON_ABSENT) @JsonProperty("uri") private String uri; @@ -69,10 +64,9 @@ public VideoDelta( this.type = Builder._SINGLETON_VALUE_Type.value(); this.uri = uri; } - + public VideoDelta() { - this(null, null, null, - null); + this(null, null, null, null); } public Optional data() { @@ -100,31 +94,26 @@ public static Builder builder() { return new Builder(); } - public VideoDelta withData(@Nullable String data) { this.data = data; return this; } - public VideoDelta withMimeType(@Nullable VideoDeltaMimeType mimeType) { this.mimeType = mimeType; return this; } - public VideoDelta withResolution(@Nullable MediaResolution resolution) { this.resolution = resolution; return this; } - public VideoDelta withUri(@Nullable String uri) { this.uri = uri; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -134,33 +123,36 @@ public boolean equals(java.lang.Object o) { return false; } VideoDelta other = (VideoDelta) o; - return - Utils.enhancedDeepEquals(this.data, other.data) && - Utils.enhancedDeepEquals(this.mimeType, other.mimeType) && - Utils.enhancedDeepEquals(this.resolution, other.resolution) && - Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.uri, other.uri); - } - + return Utils.enhancedDeepEquals(this.data, other.data) + && Utils.enhancedDeepEquals(this.mimeType, other.mimeType) + && Utils.enhancedDeepEquals(this.resolution, other.resolution) + && Utils.enhancedDeepEquals(this.type, other.type) + && Utils.enhancedDeepEquals(this.uri, other.uri); + } + @Override public int hashCode() { - return Utils.enhancedHash( - data, mimeType, resolution, - type, uri); + return Utils.enhancedHash(data, mimeType, resolution, type, uri); } - + @Override public String toString() { - return Utils.toString(VideoDelta.class, - "data", data, - "mimeType", mimeType, - "resolution", resolution, - "type", type, - "uri", uri); + return Utils.toString( + VideoDelta.class, + "data", + data, + "mimeType", + mimeType, + "resolution", + resolution, + "type", + type, + "uri", + uri); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String data; @@ -171,7 +163,7 @@ public final static class Builder { private String uri; private Builder() { - // force use of static builder() method + // force use of static builder() method } public Builder data(@Nullable String data) { @@ -195,16 +187,10 @@ public Builder uri(@Nullable String uri) { } public VideoDelta build() { - return new VideoDelta( - data, mimeType, resolution, - uri); + return new VideoDelta(data, mimeType, resolution, uri); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"video\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"video\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/VideoDeltaMimeType.java b/src/main/java/com/google/genai/gaos/models/interactions/VideoDeltaMimeType.java index 3516fe60aeb..0ba3eedec83 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/VideoDeltaMimeType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/VideoDeltaMimeType.java @@ -61,12 +61,12 @@ private VideoDeltaMimeType(String value) { } /** - * Returns a VideoDeltaMimeType with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a VideoDeltaMimeType with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as VideoDeltaMimeType - */ + */ @JsonCreator public static VideoDeltaMimeType of(String value) { synchronized (VideoDeltaMimeType.class) { @@ -94,12 +94,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; VideoDeltaMimeType other = (VideoDeltaMimeType) obj; return Objects.equals(value, other.value); } @@ -143,8 +140,7 @@ private static final Map createEnumsMap() { map.put("video/3gpp", VideoDeltaMimeTypeEnum.VIDEO3GPP); return map; } - - + public enum VideoDeltaMimeTypeEnum { VIDEO_MP4("video/mp4"), @@ -155,7 +151,8 @@ public enum VideoDeltaMimeTypeEnum { VIDEO_X_FLV("video/x-flv"), VIDEO_WEBM("video/webm"), VIDEO_WMV("video/wmv"), - VIDEO3GPP("video/3gpp"),; + VIDEO3GPP("video/3gpp"), + ; private final String value; @@ -168,4 +165,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/VideoResponseFormat.java b/src/main/java/com/google/genai/gaos/models/interactions/VideoResponseFormat.java index 9d1e65b5181..e2154429cc8 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/VideoResponseFormat.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/VideoResponseFormat.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -33,7 +33,7 @@ /** * VideoResponseFormat - * + * *

Configuration for video output format. */ public class VideoResponseFormat { @@ -59,13 +59,19 @@ public class VideoResponseFormat { private String duration; /** - * The GCS URI to store the video output. Required for Vertex if delivery mode - * is URI. + * The Cloud Storage URI to store the video output. Required for Vertex if + * delivery mode is URI. */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("gcs_uri") private String gcsUri; + /** + * The video output resolution. Defaults to 720p. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("resolution") + private Resolution resolution; @JsonProperty("type") private String type; @@ -75,17 +81,18 @@ public VideoResponseFormat( @JsonProperty("aspect_ratio") @Nullable VideoResponseFormatAspectRatio aspectRatio, @JsonProperty("delivery") @Nullable VideoResponseFormatDelivery delivery, @JsonProperty("duration") @Nullable String duration, - @JsonProperty("gcs_uri") @Nullable String gcsUri) { + @JsonProperty("gcs_uri") @Nullable String gcsUri, + @JsonProperty("resolution") @Nullable Resolution resolution) { this.aspectRatio = aspectRatio; this.delivery = delivery; this.duration = duration; this.gcsUri = gcsUri; + this.resolution = resolution; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public VideoResponseFormat() { - this(null, null, null, - null); + this(null, null, null, null, null); } /** @@ -110,13 +117,20 @@ public Optional duration() { } /** - * The GCS URI to store the video output. Required for Vertex if delivery mode - * is URI. + * The Cloud Storage URI to store the video output. Required for Vertex if + * delivery mode is URI. */ public Optional gcsUri() { return Optional.ofNullable(this.gcsUri); } + /** + * The video output resolution. Defaults to 720p. + */ + public Optional resolution() { + return Optional.ofNullable(this.resolution); + } + public Optional type() { return Optional.ofNullable(this.type); } @@ -125,7 +139,6 @@ public static Builder builder() { return new Builder(); } - /** * The aspect ratio for the video output. */ @@ -134,7 +147,6 @@ public VideoResponseFormat withAspectRatio(@Nullable VideoResponseFormatAspectRa return this; } - /** * The delivery mode for the video output. */ @@ -143,7 +155,6 @@ public VideoResponseFormat withDelivery(@Nullable VideoResponseFormatDelivery de return this; } - /** * The duration for the video output. */ @@ -152,16 +163,22 @@ public VideoResponseFormat withDuration(@Nullable String duration) { return this; } - /** - * The GCS URI to store the video output. Required for Vertex if delivery mode - * is URI. + * The Cloud Storage URI to store the video output. Required for Vertex if + * delivery mode is URI. */ public VideoResponseFormat withGcsUri(@Nullable String gcsUri) { this.gcsUri = gcsUri; return this; } + /** + * The video output resolution. Defaults to 720p. + */ + public VideoResponseFormat withResolution(@Nullable Resolution resolution) { + this.resolution = resolution; + return this; + } @Override public boolean equals(java.lang.Object o) { @@ -172,33 +189,39 @@ public boolean equals(java.lang.Object o) { return false; } VideoResponseFormat other = (VideoResponseFormat) o; - return - Utils.enhancedDeepEquals(this.aspectRatio, other.aspectRatio) && - Utils.enhancedDeepEquals(this.delivery, other.delivery) && - Utils.enhancedDeepEquals(this.duration, other.duration) && - Utils.enhancedDeepEquals(this.gcsUri, other.gcsUri) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.aspectRatio, other.aspectRatio) + && Utils.enhancedDeepEquals(this.delivery, other.delivery) + && Utils.enhancedDeepEquals(this.duration, other.duration) + && Utils.enhancedDeepEquals(this.gcsUri, other.gcsUri) + && Utils.enhancedDeepEquals(this.resolution, other.resolution) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - aspectRatio, delivery, duration, - gcsUri, type); + return Utils.enhancedHash(aspectRatio, delivery, duration, gcsUri, resolution, type); } - + @Override public String toString() { - return Utils.toString(VideoResponseFormat.class, - "aspectRatio", aspectRatio, - "delivery", delivery, - "duration", duration, - "gcsUri", gcsUri, - "type", type); + return Utils.toString( + VideoResponseFormat.class, + "aspectRatio", + aspectRatio, + "delivery", + delivery, + "duration", + duration, + "gcsUri", + gcsUri, + "resolution", + resolution, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private VideoResponseFormatAspectRatio aspectRatio; @@ -208,8 +231,10 @@ public final static class Builder { private String gcsUri; + private Resolution resolution; + private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -237,25 +262,27 @@ public Builder duration(@Nullable String duration) { } /** - * The GCS URI to store the video output. Required for Vertex if delivery mode - * is URI. + * The Cloud Storage URI to store the video output. Required for Vertex if + * delivery mode is URI. */ public Builder gcsUri(@Nullable String gcsUri) { this.gcsUri = gcsUri; return this; } - public VideoResponseFormat build() { - return new VideoResponseFormat( - aspectRatio, delivery, duration, - gcsUri); + /** + * The video output resolution. Defaults to 720p. + */ + public Builder resolution(@Nullable Resolution resolution) { + this.resolution = resolution; + return this; } + public VideoResponseFormat build() { + return new VideoResponseFormat(aspectRatio, delivery, duration, gcsUri, resolution); + } private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"video\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"video\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/VideoResponseFormatAspectRatio.java b/src/main/java/com/google/genai/gaos/models/interactions/VideoResponseFormatAspectRatio.java index 8c2acb77ab8..1fbb82ad90a 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/VideoResponseFormatAspectRatio.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/VideoResponseFormatAspectRatio.java @@ -36,13 +36,15 @@ */ /** * VideoResponseFormatAspectRatio - * + * *

The aspect ratio for the video output. */ public class VideoResponseFormatAspectRatio { - public static final VideoResponseFormatAspectRatio ONE_HUNDRED_AND_SIXTY_NINE = new VideoResponseFormatAspectRatio("16:9"); - public static final VideoResponseFormatAspectRatio NINE_HUNDRED_AND_SIXTEEN = new VideoResponseFormatAspectRatio("9:16"); + public static final VideoResponseFormatAspectRatio ONE_HUNDRED_AND_SIXTY_NINE = + new VideoResponseFormatAspectRatio("16:9"); + public static final VideoResponseFormatAspectRatio NINE_HUNDRED_AND_SIXTEEN = + new VideoResponseFormatAspectRatio("9:16"); // This map will grow whenever a Color gets created with a new // unrecognized value (a potential memory leak if the user is not @@ -59,12 +61,12 @@ private VideoResponseFormatAspectRatio(String value) { } /** - * Returns a VideoResponseFormatAspectRatio with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a VideoResponseFormatAspectRatio with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as VideoResponseFormatAspectRatio - */ + */ @JsonCreator public static VideoResponseFormatAspectRatio of(String value) { synchronized (VideoResponseFormatAspectRatio.class) { @@ -92,12 +94,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; VideoResponseFormatAspectRatio other = (VideoResponseFormatAspectRatio) obj; return Objects.equals(value, other.value); } @@ -127,12 +126,12 @@ private static final Map createEnums map.put("9:16", VideoResponseFormatAspectRatioEnum.NINE_HUNDRED_AND_SIXTEEN); return map; } - - + public enum VideoResponseFormatAspectRatioEnum { ONE_HUNDRED_AND_SIXTY_NINE("16:9"), - NINE_HUNDRED_AND_SIXTEEN("9:16"),; + NINE_HUNDRED_AND_SIXTEEN("9:16"), + ; private final String value; @@ -145,4 +144,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/VideoResponseFormatDelivery.java b/src/main/java/com/google/genai/gaos/models/interactions/VideoResponseFormatDelivery.java index 42ea692b84c..07e8caaa668 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/VideoResponseFormatDelivery.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/VideoResponseFormatDelivery.java @@ -36,7 +36,7 @@ */ /** * VideoResponseFormatDelivery - * + * *

The delivery mode for the video output. */ public class VideoResponseFormatDelivery { @@ -59,12 +59,12 @@ private VideoResponseFormatDelivery(String value) { } /** - * Returns a VideoResponseFormatDelivery with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a VideoResponseFormatDelivery with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as VideoResponseFormatDelivery - */ + */ @JsonCreator public static VideoResponseFormatDelivery of(String value) { synchronized (VideoResponseFormatDelivery.class) { @@ -92,12 +92,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; VideoResponseFormatDelivery other = (VideoResponseFormatDelivery) obj; return Objects.equals(value, other.value); } @@ -127,12 +124,12 @@ private static final Map createEnumsMap map.put("uri", VideoResponseFormatDeliveryEnum.URI); return map; } - - + public enum VideoResponseFormatDeliveryEnum { INLINE("inline"), - URI("uri"),; + URI("uri"), + ; private final String value; @@ -145,4 +142,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Visualization.java b/src/main/java/com/google/genai/gaos/models/interactions/Visualization.java index 624cd095d20..c98916bba92 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Visualization.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Visualization.java @@ -36,7 +36,7 @@ */ /** * Visualization - * + * *

Whether to include visualizations in the response. */ public class Visualization { @@ -59,12 +59,12 @@ private Visualization(String value) { } /** - * Returns a Visualization with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a Visualization with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as Visualization - */ + */ @JsonCreator public static Visualization of(String value) { synchronized (Visualization.class) { @@ -92,12 +92,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; Visualization other = (Visualization) obj; return Objects.equals(value, other.value); } @@ -127,12 +124,12 @@ private static final Map createEnumsMap() { map.put("auto", VisualizationEnum.AUTO); return map; } - - + public enum VisualizationEnum { OFF("off"), - AUTO("auto"),; + AUTO("auto"), + ; private final String value; @@ -145,4 +142,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/WebhookConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/WebhookConfig.java index cbe41dce33e..360966ca8b4 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/WebhookConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/WebhookConfig.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -34,7 +34,7 @@ /** * WebhookConfig - * + * *

Message for configuring webhook events for a request. */ public class WebhookConfig { @@ -61,7 +61,7 @@ public WebhookConfig( this.uris = uris; this.userMetadata = userMetadata; } - + public WebhookConfig() { this(null, null); } @@ -86,7 +86,6 @@ public static Builder builder() { return new Builder(); } - /** * Optional. If set, these webhook URIs will be used for webhook events instead of the * registered webhooks. @@ -96,7 +95,6 @@ public WebhookConfig withUris(@Nullable List uris) { return this; } - /** * Optional. The user metadata that will be returned on each event emission to the * webhooks. @@ -106,7 +104,6 @@ public WebhookConfig withUserMetadata(@Nullable Map userMetadata return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -116,33 +113,29 @@ public boolean equals(java.lang.Object o) { return false; } WebhookConfig other = (WebhookConfig) o; - return - Utils.enhancedDeepEquals(this.uris, other.uris) && - Utils.enhancedDeepEquals(this.userMetadata, other.userMetadata); + return Utils.enhancedDeepEquals(this.uris, other.uris) + && Utils.enhancedDeepEquals(this.userMetadata, other.userMetadata); } - + @Override public int hashCode() { - return Utils.enhancedHash( - uris, userMetadata); + return Utils.enhancedHash(uris, userMetadata); } - + @Override public String toString() { - return Utils.toString(WebhookConfig.class, - "uris", uris, - "userMetadata", userMetadata); + return Utils.toString(WebhookConfig.class, "uris", uris, "userMetadata", userMetadata); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private List uris; private Map userMetadata; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -164,9 +157,7 @@ public Builder userMetadata(@Nullable Map userMetadata) { } public WebhookConfig build() { - return new WebhookConfig( - uris, userMetadata); + return new WebhookConfig(uris, userMetadata); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/WordInfo.java b/src/main/java/com/google/genai/gaos/models/interactions/WordInfo.java index e4ec371264b..11bdd90bb87 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/WordInfo.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/WordInfo.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.interactions; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.utils.LazySingletonValue; @@ -34,7 +34,7 @@ /** * WordInfo - * + * *

Word-level ASR annotation for transcription output. * Carries the word text, optional timing, and optional speaker attribution. */ @@ -64,7 +64,7 @@ public class WordInfo implements Annotation { /** * Start of segment of the response that is attributed to this source. - * + * *

Index indicates the start of the segment, measured in bytes. */ @JsonInclude(Include.NON_ABSENT) @@ -86,7 +86,6 @@ public class WordInfo implements Annotation { @JsonProperty("text") private String text; - @JsonProperty("type") private String type; @@ -106,10 +105,9 @@ public WordInfo( this.text = text; this.type = Builder._SINGLETON_VALUE_Type.value(); } - + public WordInfo() { - this(null, null, null, - null, null, null); + this(null, null, null, null, null, null); } /** @@ -137,7 +135,7 @@ public Optional speaker() { /** * Start of segment of the response that is attributed to this source. - * + * *

Index indicates the start of the segment, measured in bytes. */ public Optional startIndex() { @@ -168,7 +166,6 @@ public static Builder builder() { return new Builder(); } - /** * End of the attributed segment, exclusive. */ @@ -177,7 +174,6 @@ public WordInfo withEndIndex(@Nullable Integer endIndex) { return this; } - /** * End offset in time of the word relative to the start of the audio. * Present when timestamp_granularities contains "word". @@ -187,7 +183,6 @@ public WordInfo withEndOffset(@Nullable String endOffset) { return this; } - /** * Optional. Speaker label for this word (e.g. "spk_1", "spk_2"). * Present when diarization_mode is set in TranscriptionConfig. @@ -197,10 +192,9 @@ public WordInfo withSpeaker(@Nullable String speaker) { return this; } - /** * Start of segment of the response that is attributed to this source. - * + * *

Index indicates the start of the segment, measured in bytes. */ public WordInfo withStartIndex(@Nullable Integer startIndex) { @@ -208,7 +202,6 @@ public WordInfo withStartIndex(@Nullable Integer startIndex) { return this; } - /** * Start offset in time of the word relative to the start of the audio. * Present when timestamp_granularities contains "word". @@ -218,7 +211,6 @@ public WordInfo withStartOffset(@Nullable String startOffset) { return this; } - /** * The transcribed word. */ @@ -227,7 +219,6 @@ public WordInfo withText(@Nullable String text) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -237,38 +228,42 @@ public boolean equals(java.lang.Object o) { return false; } WordInfo other = (WordInfo) o; - return - Utils.enhancedDeepEquals(this.endIndex, other.endIndex) && - Utils.enhancedDeepEquals(this.endOffset, other.endOffset) && - Utils.enhancedDeepEquals(this.speaker, other.speaker) && - Utils.enhancedDeepEquals(this.startIndex, other.startIndex) && - Utils.enhancedDeepEquals(this.startOffset, other.startOffset) && - Utils.enhancedDeepEquals(this.text, other.text) && - Utils.enhancedDeepEquals(this.type, other.type); + return Utils.enhancedDeepEquals(this.endIndex, other.endIndex) + && Utils.enhancedDeepEquals(this.endOffset, other.endOffset) + && Utils.enhancedDeepEquals(this.speaker, other.speaker) + && Utils.enhancedDeepEquals(this.startIndex, other.startIndex) + && Utils.enhancedDeepEquals(this.startOffset, other.startOffset) + && Utils.enhancedDeepEquals(this.text, other.text) + && Utils.enhancedDeepEquals(this.type, other.type); } - + @Override public int hashCode() { - return Utils.enhancedHash( - endIndex, endOffset, speaker, - startIndex, startOffset, text, - type); + return Utils.enhancedHash(endIndex, endOffset, speaker, startIndex, startOffset, text, type); } - + @Override public String toString() { - return Utils.toString(WordInfo.class, - "endIndex", endIndex, - "endOffset", endOffset, - "speaker", speaker, - "startIndex", startIndex, - "startOffset", startOffset, - "text", text, - "type", type); + return Utils.toString( + WordInfo.class, + "endIndex", + endIndex, + "endOffset", + endOffset, + "speaker", + speaker, + "startIndex", + startIndex, + "startOffset", + startOffset, + "text", + text, + "type", + type); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Integer endIndex; @@ -283,7 +278,7 @@ public final static class Builder { private String text; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -314,7 +309,7 @@ public Builder speaker(@Nullable String speaker) { /** * Start of segment of the response that is attributed to this source. - * + * *

Index indicates the start of the segment, measured in bytes. */ public Builder startIndex(@Nullable Integer startIndex) { @@ -340,16 +335,10 @@ public Builder text(@Nullable String text) { } public WordInfo build() { - return new WordInfo( - endIndex, endOffset, speaker, - startIndex, startOffset, text); + return new WordInfo(endIndex, endOffset, speaker, startIndex, startOffset, text); } - private static final LazySingletonValue _SINGLETON_VALUE_Type = - new LazySingletonValue<>( - "type", - "\"word_info\"", - new TypeReference() {}); + new LazySingletonValue<>("type", "\"word_info\"", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdRequest.java b/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdRequest.java index 6419d57867a..1cc256d10f9 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdRequest.java @@ -28,7 +28,6 @@ import java.lang.String; import java.util.Optional; - public class CancelInteractionByIdRequest { /** * The unique identifier of the interaction to cancel. @@ -43,16 +42,12 @@ public class CancelInteractionByIdRequest { private String apiVersion; @JsonCreator - public CancelInteractionByIdRequest( - @Nonnull String id, - @Nullable String apiVersion) { - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + public CancelInteractionByIdRequest(@Nonnull String id, @Nullable String apiVersion) { + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); this.apiVersion = apiVersion; } - - public CancelInteractionByIdRequest( - @Nonnull String id) { + + public CancelInteractionByIdRequest(@Nonnull String id) { this(id, null); } @@ -74,7 +69,6 @@ public static Builder builder() { return new Builder(); } - /** * The unique identifier of the interaction to cancel. */ @@ -83,7 +77,6 @@ public CancelInteractionByIdRequest withId(@Nonnull String id) { return this; } - /** * Which version of the API to use. */ @@ -92,7 +85,6 @@ public CancelInteractionByIdRequest withApiVersion(@Nullable String apiVersion) return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -102,33 +94,28 @@ public boolean equals(java.lang.Object o) { return false; } CancelInteractionByIdRequest other = (CancelInteractionByIdRequest) o; - return - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion); + return Utils.enhancedDeepEquals(this.id, other.id) && Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion); } - + @Override public int hashCode() { - return Utils.enhancedHash( - id, apiVersion); + return Utils.enhancedHash(id, apiVersion); } - + @Override public String toString() { - return Utils.toString(CancelInteractionByIdRequest.class, - "id", id, - "apiVersion", apiVersion); + return Utils.toString(CancelInteractionByIdRequest.class, "id", id, "apiVersion", apiVersion); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String id; private String apiVersion; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -148,9 +135,7 @@ public Builder apiVersion(@Nullable String apiVersion) { } public CancelInteractionByIdRequest build() { - return new CancelInteractionByIdRequest( - id, apiVersion); + return new CancelInteractionByIdRequest(id, apiVersion); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdRequestBuilder.java index d31928eeab9..861c860c3bb 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdRequestBuilder.java @@ -68,7 +68,7 @@ private CancelInteractionByIdRequest _buildRequest() { } return this.request; } - + public CancelInteractionByIdRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -77,14 +77,14 @@ public CancelInteractionByIdRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CancelInteractionByIdResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new CancelInteractionById.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new CancelInteractionById.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdResponse.java b/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdResponse.java index 9ada014c3c2..e858dd1636e 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class CancelInteractionByIdResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public CancelInteractionByIdResponse( @Nonnull HttpResponse rawResponse, @Nullable Interaction interaction) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.interaction = interaction; } - + public CancelInteractionByIdResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public CancelInteractionByIdResponse withContentType(@Nonnull String contentType return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public CancelInteractionByIdResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public CancelInteractionByIdResponse withRawResponse(@Nonnull HttpResponse new IllegalArgumentException("body cannot be null")); + this.body = Optional.ofNullable(body).orElseThrow(() -> new IllegalArgumentException("body cannot be null")); } - - public CreateAgentRequest( - @Nonnull Agent body) { + + public CreateAgentRequest(@Nonnull Agent body) { this(null, body); } @@ -75,7 +70,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -84,7 +78,6 @@ public CreateAgentRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * The request body. */ @@ -93,7 +86,6 @@ public CreateAgentRequest withBody(@Nonnull Agent body) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -103,33 +95,29 @@ public boolean equals(java.lang.Object o) { return false; } CreateAgentRequest other = (CreateAgentRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.body, other.body); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) + && Utils.enhancedDeepEquals(this.body, other.body); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, body); + return Utils.enhancedHash(apiVersion, body); } - + @Override public String toString() { - return Utils.toString(CreateAgentRequest.class, - "apiVersion", apiVersion, - "body", body); + return Utils.toString(CreateAgentRequest.class, "apiVersion", apiVersion, "body", body); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; private Agent body; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -149,9 +137,7 @@ public Builder body(@Nonnull Agent body) { } public CreateAgentRequest build() { - return new CreateAgentRequest( - apiVersion, body); + return new CreateAgentRequest(apiVersion, body); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CreateAgentRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/CreateAgentRequestBuilder.java index db266c47eb8..f6fe9862d9e 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CreateAgentRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CreateAgentRequestBuilder.java @@ -69,7 +69,7 @@ private CreateAgentRequest _buildRequest() { } return this.request; } - + public CreateAgentRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -78,14 +78,14 @@ public CreateAgentRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CreateAgentResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new CreateAgent.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new CreateAgent.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CreateAgentResponse.java b/src/main/java/com/google/genai/gaos/models/operations/CreateAgentResponse.java index 838cc6d05dd..15f9edd443d 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CreateAgentResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CreateAgentResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class CreateAgentResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public CreateAgentResponse( @Nonnull HttpResponse rawResponse, @Nullable Agent agent) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.agent = agent; } - + public CreateAgentResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public CreateAgentResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public CreateAgentResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public CreateAgentResponse withRawResponse(@Nonnull HttpResponse ra return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public CreateAgentResponse withAgent(@Nullable Agent agent) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } CreateAgentResponse other = (CreateAgentResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.agent, other.agent); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.agent, other.agent); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - agent); + return Utils.enhancedHash(contentType, statusCode, rawResponse, agent); } - + @Override public String toString() { - return Utils.toString(CreateAgentResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "agent", agent); + return Utils.toString( + CreateAgentResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "agent", + agent); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Agent agent; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder agent(@Nullable Agent agent) { } public CreateAgentResponse build() { - return new CreateAgentResponse( - contentType, statusCode, rawResponse, - agent); + return new CreateAgentResponse(contentType, statusCode, rawResponse, agent); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CreateEnvironmentRequest.java b/src/main/java/com/google/genai/gaos/models/operations/CreateEnvironmentRequest.java index f9385861d07..d1d45fcf0c0 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CreateEnvironmentRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CreateEnvironmentRequest.java @@ -28,7 +28,6 @@ import java.lang.String; import java.util.Optional; - public class CreateEnvironmentRequest { /** * Which version of the API to use. @@ -44,15 +43,12 @@ public class CreateEnvironmentRequest { @JsonCreator public CreateEnvironmentRequest( - @Nullable String apiVersion, - @Nonnull com.google.genai.gaos.models.environments.CreateEnvironmentRequest body) { + @Nullable String apiVersion, @Nonnull com.google.genai.gaos.models.environments.CreateEnvironmentRequest body) { this.apiVersion = apiVersion; - this.body = Optional.ofNullable(body) - .orElseThrow(() -> new IllegalArgumentException("body cannot be null")); + this.body = Optional.ofNullable(body).orElseThrow(() -> new IllegalArgumentException("body cannot be null")); } - - public CreateEnvironmentRequest( - @Nonnull com.google.genai.gaos.models.environments.CreateEnvironmentRequest body) { + + public CreateEnvironmentRequest(@Nonnull com.google.genai.gaos.models.environments.CreateEnvironmentRequest body) { this(null, body); } @@ -74,7 +70,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -83,16 +78,15 @@ public CreateEnvironmentRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * Required. The environment to create. */ - public CreateEnvironmentRequest withBody(@Nonnull com.google.genai.gaos.models.environments.CreateEnvironmentRequest body) { + public CreateEnvironmentRequest withBody( + @Nonnull com.google.genai.gaos.models.environments.CreateEnvironmentRequest body) { this.body = Utils.checkNotNull(body, "body"); return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -102,33 +96,29 @@ public boolean equals(java.lang.Object o) { return false; } CreateEnvironmentRequest other = (CreateEnvironmentRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.body, other.body); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) + && Utils.enhancedDeepEquals(this.body, other.body); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, body); + return Utils.enhancedHash(apiVersion, body); } - + @Override public String toString() { - return Utils.toString(CreateEnvironmentRequest.class, - "apiVersion", apiVersion, - "body", body); + return Utils.toString(CreateEnvironmentRequest.class, "apiVersion", apiVersion, "body", body); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; private com.google.genai.gaos.models.environments.CreateEnvironmentRequest body; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -148,9 +138,7 @@ public Builder body(@Nonnull com.google.genai.gaos.models.environments.CreateEnv } public CreateEnvironmentRequest build() { - return new CreateEnvironmentRequest( - apiVersion, body); + return new CreateEnvironmentRequest(apiVersion, body); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CreateEnvironmentRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/CreateEnvironmentRequestBuilder.java index 1601ba7a2d5..97ecfc89538 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CreateEnvironmentRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CreateEnvironmentRequestBuilder.java @@ -51,7 +51,8 @@ public CreateEnvironmentRequestBuilder apiVersion(@Nullable String apiVersion) { return this; } - public CreateEnvironmentRequestBuilder body(@Nonnull com.google.genai.gaos.models.environments.CreateEnvironmentRequest body) { + public CreateEnvironmentRequestBuilder body( + @Nonnull com.google.genai.gaos.models.environments.CreateEnvironmentRequest body) { this.pojoBuilder.body(body); this._setterCalled = true; return this; @@ -68,7 +69,7 @@ private CreateEnvironmentRequest _buildRequest() { } return this.request; } - + public CreateEnvironmentRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -77,14 +78,14 @@ public CreateEnvironmentRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CreateEnvironmentResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new CreateEnvironment.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new CreateEnvironment.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CreateEnvironmentResponse.java b/src/main/java/com/google/genai/gaos/models/operations/CreateEnvironmentResponse.java index 71909638290..f65f914615e 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CreateEnvironmentResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CreateEnvironmentResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class CreateEnvironmentResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public CreateEnvironmentResponse( @Nonnull HttpResponse rawResponse, @Nullable Environment environment) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.environment = environment; } - + public CreateEnvironmentResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public CreateEnvironmentResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public CreateEnvironmentResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public CreateEnvironmentResponse withRawResponse(@Nonnull HttpResponse new IllegalArgumentException("body cannot be null")); + this.body = Optional.ofNullable(body).orElseThrow(() -> new IllegalArgumentException("body cannot be null")); } - - public CreateInteractionRequest( - @Nonnull CreateInteractionRequestBody body) { + + public CreateInteractionRequest(@Nonnull CreateInteractionRequestBody body) { this(null, body); } @@ -74,7 +69,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -83,7 +77,6 @@ public CreateInteractionRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * The request body. */ @@ -92,7 +85,6 @@ public CreateInteractionRequest withBody(@Nonnull CreateInteractionRequestBody b return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -102,33 +94,29 @@ public boolean equals(java.lang.Object o) { return false; } CreateInteractionRequest other = (CreateInteractionRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.body, other.body); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) + && Utils.enhancedDeepEquals(this.body, other.body); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, body); + return Utils.enhancedHash(apiVersion, body); } - + @Override public String toString() { - return Utils.toString(CreateInteractionRequest.class, - "apiVersion", apiVersion, - "body", body); + return Utils.toString(CreateInteractionRequest.class, "apiVersion", apiVersion, "body", body); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; private CreateInteractionRequestBody body; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -148,9 +136,7 @@ public Builder body(@Nonnull CreateInteractionRequestBody body) { } public CreateInteractionRequest build() { - return new CreateInteractionRequest( - apiVersion, body); + return new CreateInteractionRequest(apiVersion, body); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CreateInteractionRequestBody.java b/src/main/java/com/google/genai/gaos/models/operations/CreateInteractionRequestBody.java index bb0af993166..7083a8854be 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CreateInteractionRequestBody.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CreateInteractionRequestBody.java @@ -27,9 +27,9 @@ import com.google.genai.gaos.models.interactions.CreateModelInteraction; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -37,7 +37,7 @@ /** * CreateInteractionRequestBody - * + * *

The request body. */ @JsonDeserialize(using = CreateInteractionRequestBody._Deserializer.class) @@ -45,21 +45,23 @@ public class CreateInteractionRequestBody { @JsonValue private final TypedObject value; - + private CreateInteractionRequestBody(TypedObject value) { this.value = value; } public static CreateInteractionRequestBody of(CreateModelInteraction value) { Utils.checkNotNull(value, "value"); - return new CreateInteractionRequestBody(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateInteractionRequestBody( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static CreateInteractionRequestBody of(CreateAgentInteraction value) { Utils.checkNotNull(value, "value"); - return new CreateInteractionRequestBody(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateInteractionRequestBody( + TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code CreateModelInteraction}, * otherwise returns an empty {@link Optional}. @@ -72,7 +74,7 @@ public Optional createModelInteraction() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code CreateAgentInteraction}, * otherwise returns an empty {@link Optional}. @@ -85,19 +87,19 @@ public Optional createAgentInteraction() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -109,27 +111,26 @@ public boolean equals(java.lang.Object o) { CreateInteractionRequestBody other = (CreateInteractionRequestBody) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(CreateInteractionRequestBody.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + CreateInteractionRequestBody.class, + false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(CreateInteractionRequestBody.class, - "value", value); + return Utils.toString(CreateInteractionRequestBody.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/operations/CreateInteractionRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/CreateInteractionRequestBuilder.java index 6f7bfae7440..22b39989f7d 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CreateInteractionRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CreateInteractionRequestBuilder.java @@ -68,7 +68,7 @@ private CreateInteractionRequest _buildRequest() { } return this.request; } - + public CreateInteractionRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -77,14 +77,14 @@ public CreateInteractionRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CreateInteractionResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new CreateInteraction.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new CreateInteraction.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CreateInteractionResponse.java b/src/main/java/com/google/genai/gaos/models/operations/CreateInteractionResponse.java index ca15c8852d6..9cecf705c26 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CreateInteractionResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CreateInteractionResponse.java @@ -34,7 +34,6 @@ import java.lang.String; import java.util.Optional; - public class CreateInteractionResponse implements Response { /** * HTTP response content type for this operation @@ -63,19 +62,16 @@ public CreateInteractionResponse( @Nonnull HttpResponse rawResponse, @Nullable Interaction interaction) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.interaction = interaction; } - + public CreateInteractionResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -110,18 +106,13 @@ public Optional interaction() { public EventStream events() { return new EventStream( - rawResponse.body(), - new TypeReference() {}, - Utils.mapper(), - _eventSentinel); + rawResponse.body(), new TypeReference() {}, Utils.mapper(), _eventSentinel); } - public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -130,7 +121,6 @@ public CreateInteractionResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -139,7 +129,6 @@ public CreateInteractionResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -148,7 +137,6 @@ public CreateInteractionResponse withRawResponse(@Nonnull HttpResponse new IllegalArgumentException("body cannot be null")); + this.body = Optional.ofNullable(body).orElseThrow(() -> new IllegalArgumentException("body cannot be null")); } - - public CreateTriggerRequest( - @Nonnull TriggerCreateParams body) { + + public CreateTriggerRequest(@Nonnull TriggerCreateParams body) { this(null, body); } @@ -70,7 +64,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -79,13 +72,11 @@ public CreateTriggerRequest withApiVersion(@Nullable String apiVersion) { return this; } - public CreateTriggerRequest withBody(@Nonnull TriggerCreateParams body) { this.body = Utils.checkNotNull(body, "body"); return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -95,33 +86,29 @@ public boolean equals(java.lang.Object o) { return false; } CreateTriggerRequest other = (CreateTriggerRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.body, other.body); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) + && Utils.enhancedDeepEquals(this.body, other.body); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, body); + return Utils.enhancedHash(apiVersion, body); } - + @Override public String toString() { - return Utils.toString(CreateTriggerRequest.class, - "apiVersion", apiVersion, - "body", body); + return Utils.toString(CreateTriggerRequest.class, "apiVersion", apiVersion, "body", body); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; private TriggerCreateParams body; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -138,9 +125,7 @@ public Builder body(@Nonnull TriggerCreateParams body) { } public CreateTriggerRequest build() { - return new CreateTriggerRequest( - apiVersion, body); + return new CreateTriggerRequest(apiVersion, body); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CreateTriggerRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/CreateTriggerRequestBuilder.java index f8f700008c6..3dc68d5ae97 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CreateTriggerRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CreateTriggerRequestBuilder.java @@ -69,7 +69,7 @@ private CreateTriggerRequest _buildRequest() { } return this.request; } - + public CreateTriggerRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -78,14 +78,14 @@ public CreateTriggerRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CreateTriggerResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new CreateTrigger.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new CreateTrigger.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CreateTriggerResponse.java b/src/main/java/com/google/genai/gaos/models/operations/CreateTriggerResponse.java index 46d47229e02..e8e4e8b9747 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CreateTriggerResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CreateTriggerResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class CreateTriggerResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public CreateTriggerResponse( @Nonnull HttpResponse rawResponse, @Nullable Trigger trigger) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.trigger = trigger; } - + public CreateTriggerResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public CreateTriggerResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public CreateTriggerResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public CreateTriggerResponse withRawResponse(@Nonnull HttpResponse return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public CreateTriggerResponse withTrigger(@Nullable Trigger trigger) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } CreateTriggerResponse other = (CreateTriggerResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.trigger, other.trigger); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.trigger, other.trigger); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - trigger); + return Utils.enhancedHash(contentType, statusCode, rawResponse, trigger); } - + @Override public String toString() { - return Utils.toString(CreateTriggerResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "trigger", trigger); + return Utils.toString( + CreateTriggerResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "trigger", + trigger); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Trigger trigger; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder trigger(@Nullable Trigger trigger) { } public CreateTriggerResponse build() { - return new CreateTriggerResponse( - contentType, statusCode, rawResponse, - trigger); + return new CreateTriggerResponse(contentType, statusCode, rawResponse, trigger); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CreateWebhookRequest.java b/src/main/java/com/google/genai/gaos/models/operations/CreateWebhookRequest.java index 6c9c3c33922..b775797c1ed 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CreateWebhookRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CreateWebhookRequest.java @@ -29,7 +29,6 @@ import java.lang.String; import java.util.Optional; - public class CreateWebhookRequest { /** * Which version of the API to use. @@ -44,16 +43,12 @@ public class CreateWebhookRequest { private WebhookInput body; @JsonCreator - public CreateWebhookRequest( - @Nullable String apiVersion, - @Nonnull WebhookInput body) { + public CreateWebhookRequest(@Nullable String apiVersion, @Nonnull WebhookInput body) { this.apiVersion = apiVersion; - this.body = Optional.ofNullable(body) - .orElseThrow(() -> new IllegalArgumentException("body cannot be null")); + this.body = Optional.ofNullable(body).orElseThrow(() -> new IllegalArgumentException("body cannot be null")); } - - public CreateWebhookRequest( - @Nonnull WebhookInput body) { + + public CreateWebhookRequest(@Nonnull WebhookInput body) { this(null, body); } @@ -75,7 +70,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -84,7 +78,6 @@ public CreateWebhookRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * Required. The webhook to create. */ @@ -93,7 +86,6 @@ public CreateWebhookRequest withBody(@Nonnull WebhookInput body) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -103,33 +95,29 @@ public boolean equals(java.lang.Object o) { return false; } CreateWebhookRequest other = (CreateWebhookRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.body, other.body); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) + && Utils.enhancedDeepEquals(this.body, other.body); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, body); + return Utils.enhancedHash(apiVersion, body); } - + @Override public String toString() { - return Utils.toString(CreateWebhookRequest.class, - "apiVersion", apiVersion, - "body", body); + return Utils.toString(CreateWebhookRequest.class, "apiVersion", apiVersion, "body", body); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; private WebhookInput body; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -149,9 +137,7 @@ public Builder body(@Nonnull WebhookInput body) { } public CreateWebhookRequest build() { - return new CreateWebhookRequest( - apiVersion, body); + return new CreateWebhookRequest(apiVersion, body); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CreateWebhookRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/CreateWebhookRequestBuilder.java index 79dc9a2ce07..c2d3b772ce9 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CreateWebhookRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CreateWebhookRequestBuilder.java @@ -69,7 +69,7 @@ private CreateWebhookRequest _buildRequest() { } return this.request; } - + public CreateWebhookRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -78,14 +78,14 @@ public CreateWebhookRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CreateWebhookResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new CreateWebhook.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new CreateWebhook.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CreateWebhookResponse.java b/src/main/java/com/google/genai/gaos/models/operations/CreateWebhookResponse.java index f965274bc19..2ecd0d3afd2 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CreateWebhookResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CreateWebhookResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class CreateWebhookResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public CreateWebhookResponse( @Nonnull HttpResponse rawResponse, @Nullable Webhook webhook) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.webhook = webhook; } - + public CreateWebhookResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public CreateWebhookResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public CreateWebhookResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public CreateWebhookResponse withRawResponse(@Nonnull HttpResponse return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public CreateWebhookResponse withWebhook(@Nullable Webhook webhook) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } CreateWebhookResponse other = (CreateWebhookResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.webhook, other.webhook); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.webhook, other.webhook); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - webhook); + return Utils.enhancedHash(contentType, statusCode, rawResponse, webhook); } - + @Override public String toString() { - return Utils.toString(CreateWebhookResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "webhook", webhook); + return Utils.toString( + CreateWebhookResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "webhook", + webhook); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Webhook webhook; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder webhook(@Nullable Webhook webhook) { } public CreateWebhookResponse build() { - return new CreateWebhookResponse( - contentType, statusCode, rawResponse, - webhook); + return new CreateWebhookResponse(contentType, statusCode, rawResponse, webhook); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/DeleteAgentRequest.java b/src/main/java/com/google/genai/gaos/models/operations/DeleteAgentRequest.java index a3e16c96615..debfd8698e8 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/DeleteAgentRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/DeleteAgentRequest.java @@ -28,7 +28,6 @@ import java.lang.String; import java.util.Optional; - public class DeleteAgentRequest { /** * Which version of the API to use. @@ -36,21 +35,16 @@ public class DeleteAgentRequest { @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=api_version") private String apiVersion; - @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") private String id; @JsonCreator - public DeleteAgentRequest( - @Nullable String apiVersion, - @Nonnull String id) { + public DeleteAgentRequest(@Nullable String apiVersion, @Nonnull String id) { this.apiVersion = apiVersion; - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); } - - public DeleteAgentRequest( - @Nonnull String id) { + + public DeleteAgentRequest(@Nonnull String id) { this(null, id); } @@ -69,7 +63,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -78,13 +71,11 @@ public DeleteAgentRequest withApiVersion(@Nullable String apiVersion) { return this; } - public DeleteAgentRequest withId(@Nonnull String id) { this.id = Utils.checkNotNull(id, "id"); return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -94,33 +85,28 @@ public boolean equals(java.lang.Object o) { return false; } DeleteAgentRequest other = (DeleteAgentRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.id, other.id); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && Utils.enhancedDeepEquals(this.id, other.id); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, id); + return Utils.enhancedHash(apiVersion, id); } - + @Override public String toString() { - return Utils.toString(DeleteAgentRequest.class, - "apiVersion", apiVersion, - "id", id); + return Utils.toString(DeleteAgentRequest.class, "apiVersion", apiVersion, "id", id); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; private String id; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -137,9 +123,7 @@ public Builder id(@Nonnull String id) { } public DeleteAgentRequest build() { - return new DeleteAgentRequest( - apiVersion, id); + return new DeleteAgentRequest(apiVersion, id); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/DeleteAgentRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/DeleteAgentRequestBuilder.java index 52172c3e1f7..31779b83ae2 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/DeleteAgentRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/DeleteAgentRequestBuilder.java @@ -68,7 +68,7 @@ private DeleteAgentRequest _buildRequest() { } return this.request; } - + public DeleteAgentRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -77,14 +77,14 @@ public DeleteAgentRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public DeleteAgentResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new DeleteAgent.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new DeleteAgent.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/DeleteAgentResponse.java b/src/main/java/com/google/genai/gaos/models/operations/DeleteAgentResponse.java index c1fcaaf3700..c62752f9c43 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/DeleteAgentResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/DeleteAgentResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class DeleteAgentResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public DeleteAgentResponse( @Nonnull HttpResponse rawResponse, @Nullable Empty empty) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.empty = empty; } - + public DeleteAgentResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public DeleteAgentResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public DeleteAgentResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public DeleteAgentResponse withRawResponse(@Nonnull HttpResponse ra return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public DeleteAgentResponse withEmpty(@Nullable Empty empty) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } DeleteAgentResponse other = (DeleteAgentResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.empty, other.empty); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.empty, other.empty); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - empty); + return Utils.enhancedHash(contentType, statusCode, rawResponse, empty); } - + @Override public String toString() { - return Utils.toString(DeleteAgentResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "empty", empty); + return Utils.toString( + DeleteAgentResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "empty", + empty); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Empty empty; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder empty(@Nullable Empty empty) { } public DeleteAgentResponse build() { - return new DeleteAgentResponse( - contentType, statusCode, rawResponse, - empty); + return new DeleteAgentResponse(contentType, statusCode, rawResponse, empty); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/DeleteEnvironmentRequest.java b/src/main/java/com/google/genai/gaos/models/operations/DeleteEnvironmentRequest.java index 099e11557f3..c0777c980c0 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/DeleteEnvironmentRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/DeleteEnvironmentRequest.java @@ -28,7 +28,6 @@ import java.lang.String; import java.util.Optional; - public class DeleteEnvironmentRequest { /** * Which version of the API to use. @@ -44,16 +43,12 @@ public class DeleteEnvironmentRequest { private String id; @JsonCreator - public DeleteEnvironmentRequest( - @Nullable String apiVersion, - @Nonnull String id) { + public DeleteEnvironmentRequest(@Nullable String apiVersion, @Nonnull String id) { this.apiVersion = apiVersion; - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); } - - public DeleteEnvironmentRequest( - @Nonnull String id) { + + public DeleteEnvironmentRequest(@Nonnull String id) { this(null, id); } @@ -76,7 +71,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -85,7 +79,6 @@ public DeleteEnvironmentRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * Resource ID segment making up resource `name`. It identifies the resource within its parent * collection as described in https://google.aip.dev/122. @@ -95,7 +88,6 @@ public DeleteEnvironmentRequest withId(@Nonnull String id) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -105,33 +97,28 @@ public boolean equals(java.lang.Object o) { return false; } DeleteEnvironmentRequest other = (DeleteEnvironmentRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.id, other.id); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && Utils.enhancedDeepEquals(this.id, other.id); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, id); + return Utils.enhancedHash(apiVersion, id); } - + @Override public String toString() { - return Utils.toString(DeleteEnvironmentRequest.class, - "apiVersion", apiVersion, - "id", id); + return Utils.toString(DeleteEnvironmentRequest.class, "apiVersion", apiVersion, "id", id); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; private String id; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -152,9 +139,7 @@ public Builder id(@Nonnull String id) { } public DeleteEnvironmentRequest build() { - return new DeleteEnvironmentRequest( - apiVersion, id); + return new DeleteEnvironmentRequest(apiVersion, id); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/DeleteEnvironmentRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/DeleteEnvironmentRequestBuilder.java index 84700d77022..f6fa088a2bb 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/DeleteEnvironmentRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/DeleteEnvironmentRequestBuilder.java @@ -68,7 +68,7 @@ private DeleteEnvironmentRequest _buildRequest() { } return this.request; } - + public DeleteEnvironmentRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -77,14 +77,14 @@ public DeleteEnvironmentRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public DeleteEnvironmentResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new DeleteEnvironment.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new DeleteEnvironment.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/DeleteEnvironmentResponse.java b/src/main/java/com/google/genai/gaos/models/operations/DeleteEnvironmentResponse.java index f973d4666c9..88804ed21c2 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/DeleteEnvironmentResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/DeleteEnvironmentResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class DeleteEnvironmentResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public DeleteEnvironmentResponse( @Nonnull HttpResponse rawResponse, @Nullable Empty empty) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.empty = empty; } - + public DeleteEnvironmentResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public DeleteEnvironmentResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public DeleteEnvironmentResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public DeleteEnvironmentResponse withRawResponse(@Nonnull HttpResponse new IllegalArgumentException("id cannot be null")); + public DeleteInteractionRequest(@Nonnull String id, @Nullable String apiVersion) { + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); this.apiVersion = apiVersion; } - - public DeleteInteractionRequest( - @Nonnull String id) { + + public DeleteInteractionRequest(@Nonnull String id) { this(id, null); } @@ -74,7 +69,6 @@ public static Builder builder() { return new Builder(); } - /** * The unique identifier of the interaction to delete. */ @@ -83,7 +77,6 @@ public DeleteInteractionRequest withId(@Nonnull String id) { return this; } - /** * Which version of the API to use. */ @@ -92,7 +85,6 @@ public DeleteInteractionRequest withApiVersion(@Nullable String apiVersion) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -102,33 +94,28 @@ public boolean equals(java.lang.Object o) { return false; } DeleteInteractionRequest other = (DeleteInteractionRequest) o; - return - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion); + return Utils.enhancedDeepEquals(this.id, other.id) && Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion); } - + @Override public int hashCode() { - return Utils.enhancedHash( - id, apiVersion); + return Utils.enhancedHash(id, apiVersion); } - + @Override public String toString() { - return Utils.toString(DeleteInteractionRequest.class, - "id", id, - "apiVersion", apiVersion); + return Utils.toString(DeleteInteractionRequest.class, "id", id, "apiVersion", apiVersion); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String id; private String apiVersion; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -148,9 +135,7 @@ public Builder apiVersion(@Nullable String apiVersion) { } public DeleteInteractionRequest build() { - return new DeleteInteractionRequest( - id, apiVersion); + return new DeleteInteractionRequest(id, apiVersion); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/DeleteInteractionRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/DeleteInteractionRequestBuilder.java index 3a194a4ebed..ac4972f8218 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/DeleteInteractionRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/DeleteInteractionRequestBuilder.java @@ -68,7 +68,7 @@ private DeleteInteractionRequest _buildRequest() { } return this.request; } - + public DeleteInteractionRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -77,14 +77,14 @@ public DeleteInteractionRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public DeleteInteractionResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new DeleteInteraction.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new DeleteInteraction.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/DeleteInteractionResponse.java b/src/main/java/com/google/genai/gaos/models/operations/DeleteInteractionResponse.java index 6f096089e30..cd43c149abc 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/DeleteInteractionResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/DeleteInteractionResponse.java @@ -29,7 +29,6 @@ import java.lang.String; import java.util.Optional; - public class DeleteInteractionResponse implements Response { /** * HTTP response content type for this operation @@ -48,14 +47,12 @@ public class DeleteInteractionResponse implements Response { @JsonCreator public DeleteInteractionResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); } /** @@ -83,7 +80,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -92,7 +88,6 @@ public DeleteInteractionResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -101,7 +96,6 @@ public DeleteInteractionResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -110,7 +104,6 @@ public DeleteInteractionResponse withRawResponse(@Nonnull HttpResponse rawResponse; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -178,9 +173,7 @@ public Builder rawResponse(@Nonnull HttpResponse rawResponse) { } public DeleteInteractionResponse build() { - return new DeleteInteractionResponse( - contentType, statusCode, rawResponse); + return new DeleteInteractionResponse(contentType, statusCode, rawResponse); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/DeleteTriggerRequest.java b/src/main/java/com/google/genai/gaos/models/operations/DeleteTriggerRequest.java index 8c296762e35..7125336fbd6 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/DeleteTriggerRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/DeleteTriggerRequest.java @@ -28,7 +28,6 @@ import java.lang.String; import java.util.Optional; - public class DeleteTriggerRequest { /** * Which version of the API to use. @@ -43,16 +42,12 @@ public class DeleteTriggerRequest { private String id; @JsonCreator - public DeleteTriggerRequest( - @Nullable String apiVersion, - @Nonnull String id) { + public DeleteTriggerRequest(@Nullable String apiVersion, @Nonnull String id) { this.apiVersion = apiVersion; - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); } - - public DeleteTriggerRequest( - @Nonnull String id) { + + public DeleteTriggerRequest(@Nonnull String id) { this(null, id); } @@ -74,7 +69,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -83,7 +77,6 @@ public DeleteTriggerRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * Resource name of the trigger. */ @@ -92,7 +85,6 @@ public DeleteTriggerRequest withId(@Nonnull String id) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -102,33 +94,28 @@ public boolean equals(java.lang.Object o) { return false; } DeleteTriggerRequest other = (DeleteTriggerRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.id, other.id); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && Utils.enhancedDeepEquals(this.id, other.id); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, id); + return Utils.enhancedHash(apiVersion, id); } - + @Override public String toString() { - return Utils.toString(DeleteTriggerRequest.class, - "apiVersion", apiVersion, - "id", id); + return Utils.toString(DeleteTriggerRequest.class, "apiVersion", apiVersion, "id", id); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; private String id; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -148,9 +135,7 @@ public Builder id(@Nonnull String id) { } public DeleteTriggerRequest build() { - return new DeleteTriggerRequest( - apiVersion, id); + return new DeleteTriggerRequest(apiVersion, id); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/DeleteTriggerRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/DeleteTriggerRequestBuilder.java index d4ccc3c6d9b..6461ba1f201 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/DeleteTriggerRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/DeleteTriggerRequestBuilder.java @@ -68,7 +68,7 @@ private DeleteTriggerRequest _buildRequest() { } return this.request; } - + public DeleteTriggerRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -77,14 +77,14 @@ public DeleteTriggerRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public DeleteTriggerResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new DeleteTrigger.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new DeleteTrigger.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/DeleteTriggerResponse.java b/src/main/java/com/google/genai/gaos/models/operations/DeleteTriggerResponse.java index 7312717e1b3..f9a7cf3d6af 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/DeleteTriggerResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/DeleteTriggerResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class DeleteTriggerResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public DeleteTriggerResponse( @Nonnull HttpResponse rawResponse, @Nullable Empty empty) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.empty = empty; } - + public DeleteTriggerResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public DeleteTriggerResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public DeleteTriggerResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public DeleteTriggerResponse withRawResponse(@Nonnull HttpResponse return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public DeleteTriggerResponse withEmpty(@Nullable Empty empty) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } DeleteTriggerResponse other = (DeleteTriggerResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.empty, other.empty); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.empty, other.empty); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - empty); + return Utils.enhancedHash(contentType, statusCode, rawResponse, empty); } - + @Override public String toString() { - return Utils.toString(DeleteTriggerResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "empty", empty); + return Utils.toString( + DeleteTriggerResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "empty", + empty); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Empty empty; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder empty(@Nullable Empty empty) { } public DeleteTriggerResponse build() { - return new DeleteTriggerResponse( - contentType, statusCode, rawResponse, - empty); + return new DeleteTriggerResponse(contentType, statusCode, rawResponse, empty); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/DeleteWebhookRequest.java b/src/main/java/com/google/genai/gaos/models/operations/DeleteWebhookRequest.java index b2eb606b85f..0d729110902 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/DeleteWebhookRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/DeleteWebhookRequest.java @@ -28,7 +28,6 @@ import java.lang.String; import java.util.Optional; - public class DeleteWebhookRequest { /** * Which version of the API to use. @@ -44,16 +43,12 @@ public class DeleteWebhookRequest { private String id; @JsonCreator - public DeleteWebhookRequest( - @Nullable String apiVersion, - @Nonnull String id) { + public DeleteWebhookRequest(@Nullable String apiVersion, @Nonnull String id) { this.apiVersion = apiVersion; - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); } - - public DeleteWebhookRequest( - @Nonnull String id) { + + public DeleteWebhookRequest(@Nonnull String id) { this(null, id); } @@ -76,7 +71,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -85,7 +79,6 @@ public DeleteWebhookRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * Required. The ID of the webhook to delete. * Format: `{webhook_id}` @@ -95,7 +88,6 @@ public DeleteWebhookRequest withId(@Nonnull String id) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -105,33 +97,28 @@ public boolean equals(java.lang.Object o) { return false; } DeleteWebhookRequest other = (DeleteWebhookRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.id, other.id); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && Utils.enhancedDeepEquals(this.id, other.id); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, id); + return Utils.enhancedHash(apiVersion, id); } - + @Override public String toString() { - return Utils.toString(DeleteWebhookRequest.class, - "apiVersion", apiVersion, - "id", id); + return Utils.toString(DeleteWebhookRequest.class, "apiVersion", apiVersion, "id", id); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; private String id; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -152,9 +139,7 @@ public Builder id(@Nonnull String id) { } public DeleteWebhookRequest build() { - return new DeleteWebhookRequest( - apiVersion, id); + return new DeleteWebhookRequest(apiVersion, id); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/DeleteWebhookRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/DeleteWebhookRequestBuilder.java index a4eb5b5af62..0d92d4a03ad 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/DeleteWebhookRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/DeleteWebhookRequestBuilder.java @@ -68,7 +68,7 @@ private DeleteWebhookRequest _buildRequest() { } return this.request; } - + public DeleteWebhookRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -77,14 +77,14 @@ public DeleteWebhookRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public DeleteWebhookResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new DeleteWebhook.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new DeleteWebhook.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/DeleteWebhookResponse.java b/src/main/java/com/google/genai/gaos/models/operations/DeleteWebhookResponse.java index f1039706fab..49f81e263fc 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/DeleteWebhookResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/DeleteWebhookResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class DeleteWebhookResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public DeleteWebhookResponse( @Nonnull HttpResponse rawResponse, @Nullable Empty empty) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.empty = empty; } - + public DeleteWebhookResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public DeleteWebhookResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public DeleteWebhookResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public DeleteWebhookResponse withRawResponse(@Nonnull HttpResponse return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public DeleteWebhookResponse withEmpty(@Nullable Empty empty) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } DeleteWebhookResponse other = (DeleteWebhookResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.empty, other.empty); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.empty, other.empty); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - empty); + return Utils.enhancedHash(contentType, statusCode, rawResponse, empty); } - + @Override public String toString() { - return Utils.toString(DeleteWebhookResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "empty", empty); + return Utils.toString( + DeleteWebhookResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "empty", + empty); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Empty empty; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder empty(@Nullable Empty empty) { } public DeleteWebhookResponse build() { - return new DeleteWebhookResponse( - contentType, statusCode, rawResponse, - empty); + return new DeleteWebhookResponse(contentType, statusCode, rawResponse, empty); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/GetAgentRequest.java b/src/main/java/com/google/genai/gaos/models/operations/GetAgentRequest.java index 2c68e715612..377f7b4253b 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/GetAgentRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/GetAgentRequest.java @@ -28,7 +28,6 @@ import java.lang.String; import java.util.Optional; - public class GetAgentRequest { /** * Which version of the API to use. @@ -36,21 +35,16 @@ public class GetAgentRequest { @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=api_version") private String apiVersion; - @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") private String id; @JsonCreator - public GetAgentRequest( - @Nullable String apiVersion, - @Nonnull String id) { + public GetAgentRequest(@Nullable String apiVersion, @Nonnull String id) { this.apiVersion = apiVersion; - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); } - - public GetAgentRequest( - @Nonnull String id) { + + public GetAgentRequest(@Nonnull String id) { this(null, id); } @@ -69,7 +63,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -78,13 +71,11 @@ public GetAgentRequest withApiVersion(@Nullable String apiVersion) { return this; } - public GetAgentRequest withId(@Nonnull String id) { this.id = Utils.checkNotNull(id, "id"); return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -94,33 +85,28 @@ public boolean equals(java.lang.Object o) { return false; } GetAgentRequest other = (GetAgentRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.id, other.id); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && Utils.enhancedDeepEquals(this.id, other.id); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, id); + return Utils.enhancedHash(apiVersion, id); } - + @Override public String toString() { - return Utils.toString(GetAgentRequest.class, - "apiVersion", apiVersion, - "id", id); + return Utils.toString(GetAgentRequest.class, "apiVersion", apiVersion, "id", id); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; private String id; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -137,9 +123,7 @@ public Builder id(@Nonnull String id) { } public GetAgentRequest build() { - return new GetAgentRequest( - apiVersion, id); + return new GetAgentRequest(apiVersion, id); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/GetAgentRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/GetAgentRequestBuilder.java index 60e994a91f4..d14e758e974 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/GetAgentRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/GetAgentRequestBuilder.java @@ -68,7 +68,7 @@ private GetAgentRequest _buildRequest() { } return this.request; } - + public GetAgentRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -77,14 +77,14 @@ public GetAgentRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public GetAgentResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new GetAgent.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new GetAgent.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/GetAgentResponse.java b/src/main/java/com/google/genai/gaos/models/operations/GetAgentResponse.java index a7347a70b33..2462117fe8c 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/GetAgentResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/GetAgentResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class GetAgentResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public GetAgentResponse( @Nonnull HttpResponse rawResponse, @Nullable Agent agent) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.agent = agent; } - + public GetAgentResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public GetAgentResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public GetAgentResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public GetAgentResponse withRawResponse(@Nonnull HttpResponse rawRe return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public GetAgentResponse withAgent(@Nullable Agent agent) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } GetAgentResponse other = (GetAgentResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.agent, other.agent); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.agent, other.agent); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - agent); + return Utils.enhancedHash(contentType, statusCode, rawResponse, agent); } - + @Override public String toString() { - return Utils.toString(GetAgentResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "agent", agent); + return Utils.toString( + GetAgentResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "agent", + agent); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Agent agent; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder agent(@Nullable Agent agent) { } public GetAgentResponse build() { - return new GetAgentResponse( - contentType, statusCode, rawResponse, - agent); + return new GetAgentResponse(contentType, statusCode, rawResponse, agent); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/GetEnvironmentRequest.java b/src/main/java/com/google/genai/gaos/models/operations/GetEnvironmentRequest.java index 803330eadbb..c22b74ba9a7 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/GetEnvironmentRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/GetEnvironmentRequest.java @@ -28,7 +28,6 @@ import java.lang.String; import java.util.Optional; - public class GetEnvironmentRequest { /** * Which version of the API to use. @@ -44,16 +43,12 @@ public class GetEnvironmentRequest { private String id; @JsonCreator - public GetEnvironmentRequest( - @Nullable String apiVersion, - @Nonnull String id) { + public GetEnvironmentRequest(@Nullable String apiVersion, @Nonnull String id) { this.apiVersion = apiVersion; - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); } - - public GetEnvironmentRequest( - @Nonnull String id) { + + public GetEnvironmentRequest(@Nonnull String id) { this(null, id); } @@ -76,7 +71,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -85,7 +79,6 @@ public GetEnvironmentRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * Resource ID segment making up resource `name`. It identifies the resource within its parent * collection as described in https://google.aip.dev/122. @@ -95,7 +88,6 @@ public GetEnvironmentRequest withId(@Nonnull String id) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -105,33 +97,28 @@ public boolean equals(java.lang.Object o) { return false; } GetEnvironmentRequest other = (GetEnvironmentRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.id, other.id); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && Utils.enhancedDeepEquals(this.id, other.id); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, id); + return Utils.enhancedHash(apiVersion, id); } - + @Override public String toString() { - return Utils.toString(GetEnvironmentRequest.class, - "apiVersion", apiVersion, - "id", id); + return Utils.toString(GetEnvironmentRequest.class, "apiVersion", apiVersion, "id", id); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; private String id; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -152,9 +139,7 @@ public Builder id(@Nonnull String id) { } public GetEnvironmentRequest build() { - return new GetEnvironmentRequest( - apiVersion, id); + return new GetEnvironmentRequest(apiVersion, id); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/GetEnvironmentRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/GetEnvironmentRequestBuilder.java index fd0469b17c8..a5817bc0c24 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/GetEnvironmentRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/GetEnvironmentRequestBuilder.java @@ -68,7 +68,7 @@ private GetEnvironmentRequest _buildRequest() { } return this.request; } - + public GetEnvironmentRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -77,14 +77,14 @@ public GetEnvironmentRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public GetEnvironmentResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new GetEnvironment.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new GetEnvironment.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/GetEnvironmentResponse.java b/src/main/java/com/google/genai/gaos/models/operations/GetEnvironmentResponse.java index d7d286775b6..ad31d9c2c71 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/GetEnvironmentResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/GetEnvironmentResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class GetEnvironmentResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public GetEnvironmentResponse( @Nonnull HttpResponse rawResponse, @Nullable Environment environment) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.environment = environment; } - + public GetEnvironmentResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public GetEnvironmentResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public GetEnvironmentResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public GetEnvironmentResponse withRawResponse(@Nonnull HttpResponse return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public GetEnvironmentResponse withEnvironment(@Nullable Environment environment) return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } GetEnvironmentResponse other = (GetEnvironmentResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.environment, other.environment); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.environment, other.environment); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - environment); + return Utils.enhancedHash(contentType, statusCode, rawResponse, environment); } - + @Override public String toString() { - return Utils.toString(GetEnvironmentResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "environment", environment); + return Utils.toString( + GetEnvironmentResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "environment", + environment); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Environment environment; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder environment(@Nullable Environment environment) { } public GetEnvironmentResponse build() { - return new GetEnvironmentResponse( - contentType, statusCode, rawResponse, - environment); + return new GetEnvironmentResponse(contentType, statusCode, rawResponse, environment); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/GetInteractionByIdRequest.java b/src/main/java/com/google/genai/gaos/models/operations/GetInteractionByIdRequest.java index f4ba3e988bb..bec5810583f 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/GetInteractionByIdRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/GetInteractionByIdRequest.java @@ -32,7 +32,6 @@ import java.lang.String; import java.util.Optional; - public class GetInteractionByIdRequest { /** * The unique identifier of the interaction to retrieve. @@ -55,7 +54,7 @@ public class GetInteractionByIdRequest { /** * If set to true, includes the input in the response. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @SpeakeasyMetadata("queryParam:style=form,explode=true,name=include_input") @@ -75,20 +74,15 @@ public GetInteractionByIdRequest( @Nullable String lastEventId, @Nullable Boolean includeInput, @Nullable String apiVersion) { - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); - this.stream = Optional.ofNullable(stream) - .orElse(Builder._SINGLETON_VALUE_Stream.value()); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.stream = Optional.ofNullable(stream).orElse(Builder._SINGLETON_VALUE_Stream.value()); this.lastEventId = lastEventId; - this.includeInput = Optional.ofNullable(includeInput) - .orElse(Builder._SINGLETON_VALUE_IncludeInput.value()); + this.includeInput = Optional.ofNullable(includeInput).orElse(Builder._SINGLETON_VALUE_IncludeInput.value()); this.apiVersion = apiVersion; } - - public GetInteractionByIdRequest( - @Nonnull String id) { - this(id, null, null, - null, null); + + public GetInteractionByIdRequest(@Nonnull String id) { + this(id, null, null, null, null); } /** @@ -115,7 +109,7 @@ public Optional lastEventId() { /** * If set to true, includes the input in the response. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -134,7 +128,6 @@ public static Builder builder() { return new Builder(); } - /** * The unique identifier of the interaction to retrieve. */ @@ -143,7 +136,6 @@ public GetInteractionByIdRequest withId(@Nonnull String id) { return this; } - /** * If set to true, the generated content will be streamed incrementally. */ @@ -152,7 +144,6 @@ public GetInteractionByIdRequest withStream(@Nullable Boolean stream) { return this; } - /** * Optional. If set, resumes the interaction stream from the next chunk after the event marked by the * event id. Can only be used if `stream` is true. @@ -162,10 +153,9 @@ public GetInteractionByIdRequest withLastEventId(@Nullable String lastEventId) { return this; } - /** * If set to true, includes the input in the response. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -174,7 +164,6 @@ public GetInteractionByIdRequest withIncludeInput(@Nullable Boolean includeInput return this; } - /** * Which version of the API to use. */ @@ -183,7 +172,6 @@ public GetInteractionByIdRequest withApiVersion(@Nullable String apiVersion) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,33 +181,36 @@ public boolean equals(java.lang.Object o) { return false; } GetInteractionByIdRequest other = (GetInteractionByIdRequest) o; - return - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.stream, other.stream) && - Utils.enhancedDeepEquals(this.lastEventId, other.lastEventId) && - Utils.enhancedDeepEquals(this.includeInput, other.includeInput) && - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion); + return Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.stream, other.stream) + && Utils.enhancedDeepEquals(this.lastEventId, other.lastEventId) + && Utils.enhancedDeepEquals(this.includeInput, other.includeInput) + && Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion); } - + @Override public int hashCode() { - return Utils.enhancedHash( - id, stream, lastEventId, - includeInput, apiVersion); + return Utils.enhancedHash(id, stream, lastEventId, includeInput, apiVersion); } - + @Override public String toString() { - return Utils.toString(GetInteractionByIdRequest.class, - "id", id, - "stream", stream, - "lastEventId", lastEventId, - "includeInput", includeInput, - "apiVersion", apiVersion); + return Utils.toString( + GetInteractionByIdRequest.class, + "id", + id, + "stream", + stream, + "lastEventId", + lastEventId, + "includeInput", + includeInput, + "apiVersion", + apiVersion); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String id; @@ -233,7 +224,7 @@ public final static class Builder { private String apiVersion; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -263,7 +254,7 @@ public Builder lastEventId(@Nullable String lastEventId) { /** * If set to true, includes the input in the response. - * + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -281,22 +272,13 @@ public Builder apiVersion(@Nullable String apiVersion) { } public GetInteractionByIdRequest build() { - return new GetInteractionByIdRequest( - id, stream, lastEventId, - includeInput, apiVersion); + return new GetInteractionByIdRequest(id, stream, lastEventId, includeInput, apiVersion); } - private static final LazySingletonValue _SINGLETON_VALUE_Stream = - new LazySingletonValue<>( - "stream", - "false", - new TypeReference() {}); + new LazySingletonValue<>("stream", "false", new TypeReference() {}); private static final LazySingletonValue _SINGLETON_VALUE_IncludeInput = - new LazySingletonValue<>( - "include_input", - "false", - new TypeReference() {}); + new LazySingletonValue<>("include_input", "false", new TypeReference() {}); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/GetInteractionByIdRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/GetInteractionByIdRequestBuilder.java index c6e4b8f4a99..349163447e6 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/GetInteractionByIdRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/GetInteractionByIdRequestBuilder.java @@ -54,7 +54,7 @@ public GetInteractionByIdRequestBuilder request(@Nonnull GetInteractionByIdReque private GetInteractionByIdRequest _buildRequest() { return this.request; } - + public GetInteractionByIdRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -63,14 +63,14 @@ public GetInteractionByIdRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public GetInteractionByIdResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new GetInteractionById.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new GetInteractionById.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/GetInteractionByIdResponse.java b/src/main/java/com/google/genai/gaos/models/operations/GetInteractionByIdResponse.java index eb62743f95b..553eff2e596 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/GetInteractionByIdResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/GetInteractionByIdResponse.java @@ -34,7 +34,6 @@ import java.lang.String; import java.util.Optional; - public class GetInteractionByIdResponse implements Response { /** * HTTP response content type for this operation @@ -63,19 +62,16 @@ public GetInteractionByIdResponse( @Nonnull HttpResponse rawResponse, @Nullable Interaction interaction) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.interaction = interaction; } - + public GetInteractionByIdResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -110,18 +106,13 @@ public Optional interaction() { public EventStream events() { return new EventStream( - rawResponse.body(), - new TypeReference() {}, - Utils.mapper(), - _eventSentinel); + rawResponse.body(), new TypeReference() {}, Utils.mapper(), _eventSentinel); } - public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -130,7 +121,6 @@ public GetInteractionByIdResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -139,7 +129,6 @@ public GetInteractionByIdResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -148,7 +137,6 @@ public GetInteractionByIdResponse withRawResponse(@Nonnull HttpResponse new IllegalArgumentException("id cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); } - - public GetTriggerRequest( - @Nonnull String id) { + + public GetTriggerRequest(@Nonnull String id) { this(null, id); } @@ -74,7 +69,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -83,7 +77,6 @@ public GetTriggerRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * Resource name of the trigger. */ @@ -92,7 +85,6 @@ public GetTriggerRequest withId(@Nonnull String id) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -102,33 +94,28 @@ public boolean equals(java.lang.Object o) { return false; } GetTriggerRequest other = (GetTriggerRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.id, other.id); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && Utils.enhancedDeepEquals(this.id, other.id); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, id); + return Utils.enhancedHash(apiVersion, id); } - + @Override public String toString() { - return Utils.toString(GetTriggerRequest.class, - "apiVersion", apiVersion, - "id", id); + return Utils.toString(GetTriggerRequest.class, "apiVersion", apiVersion, "id", id); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; private String id; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -148,9 +135,7 @@ public Builder id(@Nonnull String id) { } public GetTriggerRequest build() { - return new GetTriggerRequest( - apiVersion, id); + return new GetTriggerRequest(apiVersion, id); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/GetTriggerRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/GetTriggerRequestBuilder.java index 1522934842f..4b92bea8414 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/GetTriggerRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/GetTriggerRequestBuilder.java @@ -68,7 +68,7 @@ private GetTriggerRequest _buildRequest() { } return this.request; } - + public GetTriggerRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -77,14 +77,14 @@ public GetTriggerRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public GetTriggerResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new GetTrigger.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new GetTrigger.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/GetTriggerResponse.java b/src/main/java/com/google/genai/gaos/models/operations/GetTriggerResponse.java index 131c979dd37..77bcf57580d 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/GetTriggerResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/GetTriggerResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class GetTriggerResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public GetTriggerResponse( @Nonnull HttpResponse rawResponse, @Nullable Trigger trigger) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.trigger = trigger; } - + public GetTriggerResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public GetTriggerResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public GetTriggerResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public GetTriggerResponse withRawResponse(@Nonnull HttpResponse raw return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public GetTriggerResponse withTrigger(@Nullable Trigger trigger) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } GetTriggerResponse other = (GetTriggerResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.trigger, other.trigger); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.trigger, other.trigger); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - trigger); + return Utils.enhancedHash(contentType, statusCode, rawResponse, trigger); } - + @Override public String toString() { - return Utils.toString(GetTriggerResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "trigger", trigger); + return Utils.toString( + GetTriggerResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "trigger", + trigger); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Trigger trigger; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder trigger(@Nullable Trigger trigger) { } public GetTriggerResponse build() { - return new GetTriggerResponse( - contentType, statusCode, rawResponse, - trigger); + return new GetTriggerResponse(contentType, statusCode, rawResponse, trigger); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/GetWebhookRequest.java b/src/main/java/com/google/genai/gaos/models/operations/GetWebhookRequest.java index a001eb4067c..604d749c8b9 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/GetWebhookRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/GetWebhookRequest.java @@ -28,7 +28,6 @@ import java.lang.String; import java.util.Optional; - public class GetWebhookRequest { /** * Which version of the API to use. @@ -43,16 +42,12 @@ public class GetWebhookRequest { private String id; @JsonCreator - public GetWebhookRequest( - @Nullable String apiVersion, - @Nonnull String id) { + public GetWebhookRequest(@Nullable String apiVersion, @Nonnull String id) { this.apiVersion = apiVersion; - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); } - - public GetWebhookRequest( - @Nonnull String id) { + + public GetWebhookRequest(@Nonnull String id) { this(null, id); } @@ -74,7 +69,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -83,7 +77,6 @@ public GetWebhookRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * Required. The ID of the webhook to retrieve. */ @@ -92,7 +85,6 @@ public GetWebhookRequest withId(@Nonnull String id) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -102,33 +94,28 @@ public boolean equals(java.lang.Object o) { return false; } GetWebhookRequest other = (GetWebhookRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.id, other.id); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && Utils.enhancedDeepEquals(this.id, other.id); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, id); + return Utils.enhancedHash(apiVersion, id); } - + @Override public String toString() { - return Utils.toString(GetWebhookRequest.class, - "apiVersion", apiVersion, - "id", id); + return Utils.toString(GetWebhookRequest.class, "apiVersion", apiVersion, "id", id); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; private String id; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -148,9 +135,7 @@ public Builder id(@Nonnull String id) { } public GetWebhookRequest build() { - return new GetWebhookRequest( - apiVersion, id); + return new GetWebhookRequest(apiVersion, id); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/GetWebhookRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/GetWebhookRequestBuilder.java index 5f8c98d3b39..283193a3cbf 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/GetWebhookRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/GetWebhookRequestBuilder.java @@ -68,7 +68,7 @@ private GetWebhookRequest _buildRequest() { } return this.request; } - + public GetWebhookRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -77,14 +77,14 @@ public GetWebhookRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public GetWebhookResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new GetWebhook.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new GetWebhook.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/GetWebhookResponse.java b/src/main/java/com/google/genai/gaos/models/operations/GetWebhookResponse.java index 21fdfd20c17..e1b80fc028a 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/GetWebhookResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/GetWebhookResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class GetWebhookResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public GetWebhookResponse( @Nonnull HttpResponse rawResponse, @Nullable Webhook webhook) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.webhook = webhook; } - + public GetWebhookResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public GetWebhookResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public GetWebhookResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public GetWebhookResponse withRawResponse(@Nonnull HttpResponse raw return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public GetWebhookResponse withWebhook(@Nullable Webhook webhook) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } GetWebhookResponse other = (GetWebhookResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.webhook, other.webhook); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.webhook, other.webhook); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - webhook); + return Utils.enhancedHash(contentType, statusCode, rawResponse, webhook); } - + @Override public String toString() { - return Utils.toString(GetWebhookResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "webhook", webhook); + return Utils.toString( + GetWebhookResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "webhook", + webhook); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Webhook webhook; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder webhook(@Nullable Webhook webhook) { } public GetWebhookResponse build() { - return new GetWebhookResponse( - contentType, statusCode, rawResponse, - webhook); + return new GetWebhookResponse(contentType, statusCode, rawResponse, webhook); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/ListAgentsRequest.java b/src/main/java/com/google/genai/gaos/models/operations/ListAgentsRequest.java index d4e91f65625..dd6e4a58f43 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/ListAgentsRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/ListAgentsRequest.java @@ -28,7 +28,6 @@ import java.lang.String; import java.util.Optional; - public class ListAgentsRequest { /** * Which version of the API to use. @@ -36,15 +35,12 @@ public class ListAgentsRequest { @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=api_version") private String apiVersion; - @SpeakeasyMetadata("queryParam:style=form,explode=true,name=page_size") private Integer pageSize; - @SpeakeasyMetadata("queryParam:style=form,explode=true,name=page_token") private String pageToken; - @SpeakeasyMetadata("queryParam:style=form,explode=true,name=parent") private String parent; @@ -59,10 +55,9 @@ public ListAgentsRequest( this.pageToken = pageToken; this.parent = parent; } - + public ListAgentsRequest() { - this(null, null, null, - null); + this(null, null, null, null); } /** @@ -88,7 +83,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -97,25 +91,21 @@ public ListAgentsRequest withApiVersion(@Nullable String apiVersion) { return this; } - public ListAgentsRequest withPageSize(@Nullable Integer pageSize) { this.pageSize = pageSize; return this; } - public ListAgentsRequest withPageToken(@Nullable String pageToken) { this.pageToken = pageToken; return this; } - public ListAgentsRequest withParent(@Nullable String parent) { this.parent = parent; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -125,31 +115,33 @@ public boolean equals(java.lang.Object o) { return false; } ListAgentsRequest other = (ListAgentsRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.pageSize, other.pageSize) && - Utils.enhancedDeepEquals(this.pageToken, other.pageToken) && - Utils.enhancedDeepEquals(this.parent, other.parent); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) + && Utils.enhancedDeepEquals(this.pageSize, other.pageSize) + && Utils.enhancedDeepEquals(this.pageToken, other.pageToken) + && Utils.enhancedDeepEquals(this.parent, other.parent); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, pageSize, pageToken, - parent); + return Utils.enhancedHash(apiVersion, pageSize, pageToken, parent); } - + @Override public String toString() { - return Utils.toString(ListAgentsRequest.class, - "apiVersion", apiVersion, - "pageSize", pageSize, - "pageToken", pageToken, - "parent", parent); + return Utils.toString( + ListAgentsRequest.class, + "apiVersion", + apiVersion, + "pageSize", + pageSize, + "pageToken", + pageToken, + "parent", + parent); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; @@ -160,7 +152,7 @@ public final static class Builder { private String parent; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -187,10 +179,7 @@ public Builder parent(@Nullable String parent) { } public ListAgentsRequest build() { - return new ListAgentsRequest( - apiVersion, pageSize, pageToken, - parent); + return new ListAgentsRequest(apiVersion, pageSize, pageToken, parent); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/ListAgentsRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/ListAgentsRequestBuilder.java index 3dd413ec465..90fb725b145 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/ListAgentsRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/ListAgentsRequestBuilder.java @@ -80,7 +80,7 @@ private ListAgentsRequest _buildRequest() { } return this.request; } - + public ListAgentsRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -89,14 +89,14 @@ public ListAgentsRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public ListAgentsResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new ListAgents.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new ListAgents.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/ListAgentsResponse.java b/src/main/java/com/google/genai/gaos/models/operations/ListAgentsResponse.java index bdbccee0e50..beefbbc60dc 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/ListAgentsResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/ListAgentsResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class ListAgentsResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public ListAgentsResponse( @Nonnull HttpResponse rawResponse, @Nullable AgentListResponse agentListResponse) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.agentListResponse = agentListResponse; } - + public ListAgentsResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public ListAgentsResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public ListAgentsResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public ListAgentsResponse withRawResponse(@Nonnull HttpResponse raw return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public ListAgentsResponse withAgentListResponse(@Nullable AgentListResponse agen return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } ListAgentsResponse other = (ListAgentsResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.agentListResponse, other.agentListResponse); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.agentListResponse, other.agentListResponse); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - agentListResponse); + return Utils.enhancedHash(contentType, statusCode, rawResponse, agentListResponse); } - + @Override public String toString() { - return Utils.toString(ListAgentsResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "agentListResponse", agentListResponse); + return Utils.toString( + ListAgentsResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "agentListResponse", + agentListResponse); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private AgentListResponse agentListResponse; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder agentListResponse(@Nullable AgentListResponse agentListResponse) } public ListAgentsResponse build() { - return new ListAgentsResponse( - contentType, statusCode, rawResponse, - agentListResponse); + return new ListAgentsResponse(contentType, statusCode, rawResponse, agentListResponse); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/ListEnvironmentsRequest.java b/src/main/java/com/google/genai/gaos/models/operations/ListEnvironmentsRequest.java index 71ddf84b78d..ba2dfb184b7 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/ListEnvironmentsRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/ListEnvironmentsRequest.java @@ -28,7 +28,6 @@ import java.lang.String; import java.util.Optional; - public class ListEnvironmentsRequest { /** * Which version of the API to use. @@ -51,14 +50,12 @@ public class ListEnvironmentsRequest { @JsonCreator public ListEnvironmentsRequest( - @Nullable String apiVersion, - @Nullable Integer pageSize, - @Nullable String pageToken) { + @Nullable String apiVersion, @Nullable Integer pageSize, @Nullable String pageToken) { this.apiVersion = apiVersion; this.pageSize = pageSize; this.pageToken = pageToken; } - + public ListEnvironmentsRequest() { this(null, null, null); } @@ -89,7 +86,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -98,7 +94,6 @@ public ListEnvironmentsRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * Optional. Maximum number of environments to return.\nIf unspecified, defaults to 50. Maximum is * 1000. @@ -108,7 +103,6 @@ public ListEnvironmentsRequest withPageSize(@Nullable Integer pageSize) { return this; } - /** * Optional. Pagination token. */ @@ -117,7 +111,6 @@ public ListEnvironmentsRequest withPageToken(@Nullable String pageToken) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -127,28 +120,24 @@ public boolean equals(java.lang.Object o) { return false; } ListEnvironmentsRequest other = (ListEnvironmentsRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.pageSize, other.pageSize) && - Utils.enhancedDeepEquals(this.pageToken, other.pageToken); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) + && Utils.enhancedDeepEquals(this.pageSize, other.pageSize) + && Utils.enhancedDeepEquals(this.pageToken, other.pageToken); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, pageSize, pageToken); + return Utils.enhancedHash(apiVersion, pageSize, pageToken); } - + @Override public String toString() { - return Utils.toString(ListEnvironmentsRequest.class, - "apiVersion", apiVersion, - "pageSize", pageSize, - "pageToken", pageToken); + return Utils.toString( + ListEnvironmentsRequest.class, "apiVersion", apiVersion, "pageSize", pageSize, "pageToken", pageToken); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; @@ -157,7 +146,7 @@ public final static class Builder { private String pageToken; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -186,9 +175,7 @@ public Builder pageToken(@Nullable String pageToken) { } public ListEnvironmentsRequest build() { - return new ListEnvironmentsRequest( - apiVersion, pageSize, pageToken); + return new ListEnvironmentsRequest(apiVersion, pageSize, pageToken); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/ListEnvironmentsRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/ListEnvironmentsRequestBuilder.java index 49dc6d44b27..87656576acd 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/ListEnvironmentsRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/ListEnvironmentsRequestBuilder.java @@ -74,7 +74,7 @@ private ListEnvironmentsRequest _buildRequest() { } return this.request; } - + public ListEnvironmentsRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -83,14 +83,14 @@ public ListEnvironmentsRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public ListEnvironmentsResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new ListEnvironments.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new ListEnvironments.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/ListEnvironmentsResponse.java b/src/main/java/com/google/genai/gaos/models/operations/ListEnvironmentsResponse.java index 78b9a95c677..650a622a2af 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/ListEnvironmentsResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/ListEnvironmentsResponse.java @@ -30,7 +30,6 @@ import java.lang.String; import java.util.Optional; - public class ListEnvironmentsResponse implements Response { /** * HTTP response content type for this operation @@ -59,19 +58,16 @@ public ListEnvironmentsResponse( @Nonnull HttpResponse rawResponse, @Nullable com.google.genai.gaos.models.environments.ListEnvironmentsResponse listEnvironmentsResponse) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.listEnvironmentsResponse = listEnvironmentsResponse; } - + public ListEnvironmentsResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -106,7 +102,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -115,7 +110,6 @@ public ListEnvironmentsResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -124,7 +118,6 @@ public ListEnvironmentsResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -133,16 +126,15 @@ public ListEnvironmentsResponse withRawResponse(@Nonnull HttpResponse rawResponse) { /** * Successful operation */ - public Builder listEnvironmentsResponse(@Nullable com.google.genai.gaos.models.environments.ListEnvironmentsResponse listEnvironmentsResponse) { + public Builder listEnvironmentsResponse( + @Nullable com.google.genai.gaos.models.environments.ListEnvironmentsResponse listEnvironmentsResponse) { this.listEnvironmentsResponse = listEnvironmentsResponse; return this; } public ListEnvironmentsResponse build() { - return new ListEnvironmentsResponse( - contentType, statusCode, rawResponse, - listEnvironmentsResponse); + return new ListEnvironmentsResponse(contentType, statusCode, rawResponse, listEnvironmentsResponse); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/ListTriggerExecutionsRequest.java b/src/main/java/com/google/genai/gaos/models/operations/ListTriggerExecutionsRequest.java index e184e7aa760..fe7454afdd3 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/ListTriggerExecutionsRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/ListTriggerExecutionsRequest.java @@ -29,7 +29,6 @@ import java.lang.String; import java.util.Optional; - public class ListTriggerExecutionsRequest { /** * Which version of the API to use. @@ -63,15 +62,13 @@ public ListTriggerExecutionsRequest( @Nullable String pageToken) { this.apiVersion = apiVersion; this.triggerId = Optional.ofNullable(triggerId) - .orElseThrow(() -> new IllegalArgumentException("triggerId cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("triggerId cannot be null")); this.pageSize = pageSize; this.pageToken = pageToken; } - - public ListTriggerExecutionsRequest( - @Nonnull String triggerId) { - this(null, triggerId, null, - null); + + public ListTriggerExecutionsRequest(@Nonnull String triggerId) { + this(null, triggerId, null, null); } /** @@ -106,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -115,7 +111,6 @@ public ListTriggerExecutionsRequest withApiVersion(@Nullable String apiVersion) return this; } - /** * Resource name of the trigger. */ @@ -124,7 +119,6 @@ public ListTriggerExecutionsRequest withTriggerId(@Nonnull String triggerId) { return this; } - /** * Optional. The maximum number of executions to return per page. */ @@ -133,7 +127,6 @@ public ListTriggerExecutionsRequest withPageSize(@Nullable Long pageSize) { return this; } - /** * Optional. A page token from a previous ListTriggerExecutions call. */ @@ -142,7 +135,6 @@ public ListTriggerExecutionsRequest withPageToken(@Nullable String pageToken) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -152,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } ListTriggerExecutionsRequest other = (ListTriggerExecutionsRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.triggerId, other.triggerId) && - Utils.enhancedDeepEquals(this.pageSize, other.pageSize) && - Utils.enhancedDeepEquals(this.pageToken, other.pageToken); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) + && Utils.enhancedDeepEquals(this.triggerId, other.triggerId) + && Utils.enhancedDeepEquals(this.pageSize, other.pageSize) + && Utils.enhancedDeepEquals(this.pageToken, other.pageToken); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, triggerId, pageSize, - pageToken); + return Utils.enhancedHash(apiVersion, triggerId, pageSize, pageToken); } - + @Override public String toString() { - return Utils.toString(ListTriggerExecutionsRequest.class, - "apiVersion", apiVersion, - "triggerId", triggerId, - "pageSize", pageSize, - "pageToken", pageToken); + return Utils.toString( + ListTriggerExecutionsRequest.class, + "apiVersion", + apiVersion, + "triggerId", + triggerId, + "pageSize", + pageSize, + "pageToken", + pageToken); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; @@ -187,7 +181,7 @@ public final static class Builder { private String pageToken; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -223,10 +217,7 @@ public Builder pageToken(@Nullable String pageToken) { } public ListTriggerExecutionsRequest build() { - return new ListTriggerExecutionsRequest( - apiVersion, triggerId, pageSize, - pageToken); + return new ListTriggerExecutionsRequest(apiVersion, triggerId, pageSize, pageToken); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/ListTriggerExecutionsRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/ListTriggerExecutionsRequestBuilder.java index aeb51dff101..df0c098562c 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/ListTriggerExecutionsRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/ListTriggerExecutionsRequestBuilder.java @@ -81,7 +81,7 @@ private ListTriggerExecutionsRequest _buildRequest() { } return this.request; } - + public ListTriggerExecutionsRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -90,14 +90,14 @@ public ListTriggerExecutionsRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public ListTriggerExecutionsResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new ListTriggerExecutions.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new ListTriggerExecutions.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/ListTriggerExecutionsResponse.java b/src/main/java/com/google/genai/gaos/models/operations/ListTriggerExecutionsResponse.java index 25a04d739d4..7bd64fb42fc 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/ListTriggerExecutionsResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/ListTriggerExecutionsResponse.java @@ -30,7 +30,6 @@ import java.lang.String; import java.util.Optional; - public class ListTriggerExecutionsResponse implements Response { /** * HTTP response content type for this operation @@ -59,19 +58,16 @@ public ListTriggerExecutionsResponse( @Nonnull HttpResponse rawResponse, @Nullable com.google.genai.gaos.models.triggers.ListTriggerExecutionsResponse listTriggerExecutionsResponse) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.listTriggerExecutionsResponse = listTriggerExecutionsResponse; } - + public ListTriggerExecutionsResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -106,7 +102,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -115,7 +110,6 @@ public ListTriggerExecutionsResponse withContentType(@Nonnull String contentType return this; } - /** * HTTP response status code for this operation */ @@ -124,7 +118,6 @@ public ListTriggerExecutionsResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -133,16 +126,15 @@ public ListTriggerExecutionsResponse withRawResponse(@Nonnull HttpResponse rawResponse) { /** * Successful operation */ - public Builder listTriggerExecutionsResponse(@Nullable com.google.genai.gaos.models.triggers.ListTriggerExecutionsResponse listTriggerExecutionsResponse) { + public Builder listTriggerExecutionsResponse( + @Nullable com.google.genai.gaos.models.triggers.ListTriggerExecutionsResponse listTriggerExecutionsResponse) { this.listTriggerExecutionsResponse = listTriggerExecutionsResponse; return this; } public ListTriggerExecutionsResponse build() { return new ListTriggerExecutionsResponse( - contentType, statusCode, rawResponse, - listTriggerExecutionsResponse); + contentType, statusCode, rawResponse, listTriggerExecutionsResponse); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/ListTriggersRequest.java b/src/main/java/com/google/genai/gaos/models/operations/ListTriggersRequest.java index d62e48e8499..6ae8a26730f 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/ListTriggersRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/ListTriggersRequest.java @@ -28,7 +28,6 @@ import java.lang.String; import java.util.Optional; - public class ListTriggersRequest { /** * Which version of the API to use. @@ -56,19 +55,15 @@ public class ListTriggersRequest { @JsonCreator public ListTriggersRequest( - @Nullable String apiVersion, - @Nullable String filter, - @Nullable Long pageSize, - @Nullable String pageToken) { + @Nullable String apiVersion, @Nullable String filter, @Nullable Long pageSize, @Nullable String pageToken) { this.apiVersion = apiVersion; this.filter = filter; this.pageSize = pageSize; this.pageToken = pageToken; } - + public ListTriggersRequest() { - this(null, null, null, - null); + this(null, null, null, null); } /** @@ -103,7 +98,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -112,7 +106,6 @@ public ListTriggersRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * Optional. Filter expression (e.g., by state). */ @@ -121,7 +114,6 @@ public ListTriggersRequest withFilter(@Nullable String filter) { return this; } - /** * Optional. The maximum number of triggers to return per page. */ @@ -130,7 +122,6 @@ public ListTriggersRequest withPageSize(@Nullable Long pageSize) { return this; } - /** * Optional. A page token from a previous ListTriggers call. */ @@ -139,7 +130,6 @@ public ListTriggersRequest withPageToken(@Nullable String pageToken) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -149,31 +139,33 @@ public boolean equals(java.lang.Object o) { return false; } ListTriggersRequest other = (ListTriggersRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.filter, other.filter) && - Utils.enhancedDeepEquals(this.pageSize, other.pageSize) && - Utils.enhancedDeepEquals(this.pageToken, other.pageToken); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) + && Utils.enhancedDeepEquals(this.filter, other.filter) + && Utils.enhancedDeepEquals(this.pageSize, other.pageSize) + && Utils.enhancedDeepEquals(this.pageToken, other.pageToken); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, filter, pageSize, - pageToken); + return Utils.enhancedHash(apiVersion, filter, pageSize, pageToken); } - + @Override public String toString() { - return Utils.toString(ListTriggersRequest.class, - "apiVersion", apiVersion, - "filter", filter, - "pageSize", pageSize, - "pageToken", pageToken); + return Utils.toString( + ListTriggersRequest.class, + "apiVersion", + apiVersion, + "filter", + filter, + "pageSize", + pageSize, + "pageToken", + pageToken); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; @@ -184,7 +176,7 @@ public final static class Builder { private String pageToken; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -220,10 +212,7 @@ public Builder pageToken(@Nullable String pageToken) { } public ListTriggersRequest build() { - return new ListTriggersRequest( - apiVersion, filter, pageSize, - pageToken); + return new ListTriggersRequest(apiVersion, filter, pageSize, pageToken); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/ListTriggersRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/ListTriggersRequestBuilder.java index 3ae6fd12dec..2d83897eda0 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/ListTriggersRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/ListTriggersRequestBuilder.java @@ -80,7 +80,7 @@ private ListTriggersRequest _buildRequest() { } return this.request; } - + public ListTriggersRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -89,14 +89,14 @@ public ListTriggersRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public ListTriggersResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new ListTriggers.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new ListTriggers.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/ListTriggersResponse.java b/src/main/java/com/google/genai/gaos/models/operations/ListTriggersResponse.java index a0d0bd5fdd1..1c44d57a101 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/ListTriggersResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/ListTriggersResponse.java @@ -30,7 +30,6 @@ import java.lang.String; import java.util.Optional; - public class ListTriggersResponse implements Response { /** * HTTP response content type for this operation @@ -59,19 +58,16 @@ public ListTriggersResponse( @Nonnull HttpResponse rawResponse, @Nullable com.google.genai.gaos.models.triggers.ListTriggersResponse listTriggersResponse) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.listTriggersResponse = listTriggersResponse; } - + public ListTriggersResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -106,7 +102,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -115,7 +110,6 @@ public ListTriggersResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -124,7 +118,6 @@ public ListTriggersResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -133,16 +126,15 @@ public ListTriggersResponse withRawResponse(@Nonnull HttpResponse r return this; } - /** * Successful operation */ - public ListTriggersResponse withListTriggersResponse(@Nullable com.google.genai.gaos.models.triggers.ListTriggersResponse listTriggersResponse) { + public ListTriggersResponse withListTriggersResponse( + @Nullable com.google.genai.gaos.models.triggers.ListTriggersResponse listTriggersResponse) { this.listTriggersResponse = listTriggersResponse; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -152,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } ListTriggersResponse other = (ListTriggersResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.listTriggersResponse, other.listTriggersResponse); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.listTriggersResponse, other.listTriggersResponse); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - listTriggersResponse); + return Utils.enhancedHash(contentType, statusCode, rawResponse, listTriggersResponse); } - + @Override public String toString() { - return Utils.toString(ListTriggersResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "listTriggersResponse", listTriggersResponse); + return Utils.toString( + ListTriggersResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "listTriggersResponse", + listTriggersResponse); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -187,7 +181,7 @@ public final static class Builder { private com.google.genai.gaos.models.triggers.ListTriggersResponse listTriggersResponse; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -217,16 +211,14 @@ public Builder rawResponse(@Nonnull HttpResponse rawResponse) { /** * Successful operation */ - public Builder listTriggersResponse(@Nullable com.google.genai.gaos.models.triggers.ListTriggersResponse listTriggersResponse) { + public Builder listTriggersResponse( + @Nullable com.google.genai.gaos.models.triggers.ListTriggersResponse listTriggersResponse) { this.listTriggersResponse = listTriggersResponse; return this; } public ListTriggersResponse build() { - return new ListTriggersResponse( - contentType, statusCode, rawResponse, - listTriggersResponse); + return new ListTriggersResponse(contentType, statusCode, rawResponse, listTriggersResponse); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/ListWebhooksRequest.java b/src/main/java/com/google/genai/gaos/models/operations/ListWebhooksRequest.java index 72ef8c744da..7268f9fc3a3 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/ListWebhooksRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/ListWebhooksRequest.java @@ -28,7 +28,6 @@ import java.lang.String; import java.util.Optional; - public class ListWebhooksRequest { /** * Which version of the API to use. @@ -52,15 +51,12 @@ public class ListWebhooksRequest { private String pageToken; @JsonCreator - public ListWebhooksRequest( - @Nullable String apiVersion, - @Nullable Integer pageSize, - @Nullable String pageToken) { + public ListWebhooksRequest(@Nullable String apiVersion, @Nullable Integer pageSize, @Nullable String pageToken) { this.apiVersion = apiVersion; this.pageSize = pageSize; this.pageToken = pageToken; } - + public ListWebhooksRequest() { this(null, null, null); } @@ -93,7 +89,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -102,7 +97,6 @@ public ListWebhooksRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * Optional. The maximum number of webhooks to return. The service may return fewer than * this value. If unspecified, at most 50 webhooks will be returned. @@ -113,7 +107,6 @@ public ListWebhooksRequest withPageSize(@Nullable Integer pageSize) { return this; } - /** * Optional. A page token, received from a previous `ListWebhooks` call. * Provide this to retrieve the subsequent page. @@ -123,7 +116,6 @@ public ListWebhooksRequest withPageToken(@Nullable String pageToken) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -133,28 +125,24 @@ public boolean equals(java.lang.Object o) { return false; } ListWebhooksRequest other = (ListWebhooksRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.pageSize, other.pageSize) && - Utils.enhancedDeepEquals(this.pageToken, other.pageToken); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) + && Utils.enhancedDeepEquals(this.pageSize, other.pageSize) + && Utils.enhancedDeepEquals(this.pageToken, other.pageToken); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, pageSize, pageToken); + return Utils.enhancedHash(apiVersion, pageSize, pageToken); } - + @Override public String toString() { - return Utils.toString(ListWebhooksRequest.class, - "apiVersion", apiVersion, - "pageSize", pageSize, - "pageToken", pageToken); + return Utils.toString( + ListWebhooksRequest.class, "apiVersion", apiVersion, "pageSize", pageSize, "pageToken", pageToken); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; @@ -163,7 +151,7 @@ public final static class Builder { private String pageToken; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -194,9 +182,7 @@ public Builder pageToken(@Nullable String pageToken) { } public ListWebhooksRequest build() { - return new ListWebhooksRequest( - apiVersion, pageSize, pageToken); + return new ListWebhooksRequest(apiVersion, pageSize, pageToken); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/ListWebhooksRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/ListWebhooksRequestBuilder.java index cfdace2658c..fb6c1200ec3 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/ListWebhooksRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/ListWebhooksRequestBuilder.java @@ -74,7 +74,7 @@ private ListWebhooksRequest _buildRequest() { } return this.request; } - + public ListWebhooksRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -83,14 +83,14 @@ public ListWebhooksRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public ListWebhooksResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new ListWebhooks.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new ListWebhooks.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/ListWebhooksResponse.java b/src/main/java/com/google/genai/gaos/models/operations/ListWebhooksResponse.java index 88a6f5532ee..d8c115eed03 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/ListWebhooksResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/ListWebhooksResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class ListWebhooksResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public ListWebhooksResponse( @Nonnull HttpResponse rawResponse, @Nullable WebhookListResponse webhookListResponse) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.webhookListResponse = webhookListResponse; } - + public ListWebhooksResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public ListWebhooksResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public ListWebhooksResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public ListWebhooksResponse withRawResponse(@Nonnull HttpResponse r return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public ListWebhooksResponse withWebhookListResponse(@Nullable WebhookListRespons return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } ListWebhooksResponse other = (ListWebhooksResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.webhookListResponse, other.webhookListResponse); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.webhookListResponse, other.webhookListResponse); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - webhookListResponse); + return Utils.enhancedHash(contentType, statusCode, rawResponse, webhookListResponse); } - + @Override public String toString() { - return Utils.toString(ListWebhooksResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "webhookListResponse", webhookListResponse); + return Utils.toString( + ListWebhooksResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "webhookListResponse", + webhookListResponse); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private WebhookListResponse webhookListResponse; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder webhookListResponse(@Nullable WebhookListResponse webhookListResp } public ListWebhooksResponse build() { - return new ListWebhooksResponse( - contentType, statusCode, rawResponse, - webhookListResponse); + return new ListWebhooksResponse(contentType, statusCode, rawResponse, webhookListResponse); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/PingWebhookRequest.java b/src/main/java/com/google/genai/gaos/models/operations/PingWebhookRequest.java index 9b116e0a8da..c346be56519 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/PingWebhookRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/PingWebhookRequest.java @@ -28,7 +28,6 @@ import java.lang.String; import java.util.Optional; - public class PingWebhookRequest { /** * Which version of the API to use. @@ -55,13 +54,11 @@ public PingWebhookRequest( @Nonnull String id, @Nullable com.google.genai.gaos.models.webhooks.PingWebhookRequest body) { this.apiVersion = apiVersion; - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); this.body = body; } - - public PingWebhookRequest( - @Nonnull String id) { + + public PingWebhookRequest(@Nonnull String id) { this(null, id, null); } @@ -91,7 +88,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -100,7 +96,6 @@ public PingWebhookRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * Required. The ID of the webhook to ping. * Format: `{webhook_id}` @@ -110,7 +105,6 @@ public PingWebhookRequest withId(@Nonnull String id) { return this; } - /** * The request body. */ @@ -119,7 +113,6 @@ public PingWebhookRequest withBody(@Nullable com.google.genai.gaos.models.webhoo return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -129,28 +122,23 @@ public boolean equals(java.lang.Object o) { return false; } PingWebhookRequest other = (PingWebhookRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.body, other.body); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) + && Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.body, other.body); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, id, body); + return Utils.enhancedHash(apiVersion, id, body); } - + @Override public String toString() { - return Utils.toString(PingWebhookRequest.class, - "apiVersion", apiVersion, - "id", id, - "body", body); + return Utils.toString(PingWebhookRequest.class, "apiVersion", apiVersion, "id", id, "body", body); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; @@ -159,7 +147,7 @@ public final static class Builder { private com.google.genai.gaos.models.webhooks.PingWebhookRequest body; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -188,9 +176,7 @@ public Builder body(@Nullable com.google.genai.gaos.models.webhooks.PingWebhookR } public PingWebhookRequest build() { - return new PingWebhookRequest( - apiVersion, id, body); + return new PingWebhookRequest(apiVersion, id, body); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/PingWebhookRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/PingWebhookRequestBuilder.java index c44569d5903..4209eb6c261 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/PingWebhookRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/PingWebhookRequestBuilder.java @@ -74,7 +74,7 @@ private PingWebhookRequest _buildRequest() { } return this.request; } - + public PingWebhookRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -83,14 +83,14 @@ public PingWebhookRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public PingWebhookResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new PingWebhook.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new PingWebhook.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/PingWebhookResponse.java b/src/main/java/com/google/genai/gaos/models/operations/PingWebhookResponse.java index b54cd584d38..57df8e202c2 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/PingWebhookResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/PingWebhookResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class PingWebhookResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public PingWebhookResponse( @Nonnull HttpResponse rawResponse, @Nullable WebhookPingResponse webhookPingResponse) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.webhookPingResponse = webhookPingResponse; } - + public PingWebhookResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public PingWebhookResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public PingWebhookResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public PingWebhookResponse withRawResponse(@Nonnull HttpResponse ra return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public PingWebhookResponse withWebhookPingResponse(@Nullable WebhookPingResponse return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } PingWebhookResponse other = (PingWebhookResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.webhookPingResponse, other.webhookPingResponse); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.webhookPingResponse, other.webhookPingResponse); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - webhookPingResponse); + return Utils.enhancedHash(contentType, statusCode, rawResponse, webhookPingResponse); } - + @Override public String toString() { - return Utils.toString(PingWebhookResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "webhookPingResponse", webhookPingResponse); + return Utils.toString( + PingWebhookResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "webhookPingResponse", + webhookPingResponse); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private WebhookPingResponse webhookPingResponse; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder webhookPingResponse(@Nullable WebhookPingResponse webhookPingResp } public PingWebhookResponse build() { - return new PingWebhookResponse( - contentType, statusCode, rawResponse, - webhookPingResponse); + return new PingWebhookResponse(contentType, statusCode, rawResponse, webhookPingResponse); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/RotateSigningSecretRequest.java b/src/main/java/com/google/genai/gaos/models/operations/RotateSigningSecretRequest.java index 75ba1f650a9..f70310366e7 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/RotateSigningSecretRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/RotateSigningSecretRequest.java @@ -28,7 +28,6 @@ import java.lang.String; import java.util.Optional; - public class RotateSigningSecretRequest { /** * Which version of the API to use. @@ -55,13 +54,11 @@ public RotateSigningSecretRequest( @Nonnull String id, @Nullable com.google.genai.gaos.models.webhooks.RotateSigningSecretRequest body) { this.apiVersion = apiVersion; - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); this.body = body; } - - public RotateSigningSecretRequest( - @Nonnull String id) { + + public RotateSigningSecretRequest(@Nonnull String id) { this(null, id, null); } @@ -91,7 +88,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -100,7 +96,6 @@ public RotateSigningSecretRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * Required. The ID of the webhook for which to generate a signing secret. * Format: `{webhook_id}` @@ -110,16 +105,15 @@ public RotateSigningSecretRequest withId(@Nonnull String id) { return this; } - /** * The request body. */ - public RotateSigningSecretRequest withBody(@Nullable com.google.genai.gaos.models.webhooks.RotateSigningSecretRequest body) { + public RotateSigningSecretRequest withBody( + @Nullable com.google.genai.gaos.models.webhooks.RotateSigningSecretRequest body) { this.body = body; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -129,28 +123,23 @@ public boolean equals(java.lang.Object o) { return false; } RotateSigningSecretRequest other = (RotateSigningSecretRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.body, other.body); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) + && Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.body, other.body); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, id, body); + return Utils.enhancedHash(apiVersion, id, body); } - + @Override public String toString() { - return Utils.toString(RotateSigningSecretRequest.class, - "apiVersion", apiVersion, - "id", id, - "body", body); + return Utils.toString(RotateSigningSecretRequest.class, "apiVersion", apiVersion, "id", id, "body", body); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; @@ -159,7 +148,7 @@ public final static class Builder { private com.google.genai.gaos.models.webhooks.RotateSigningSecretRequest body; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -188,9 +177,7 @@ public Builder body(@Nullable com.google.genai.gaos.models.webhooks.RotateSignin } public RotateSigningSecretRequest build() { - return new RotateSigningSecretRequest( - apiVersion, id, body); + return new RotateSigningSecretRequest(apiVersion, id, body); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/RotateSigningSecretRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/RotateSigningSecretRequestBuilder.java index eec3c6e8512..c7cfe68f378 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/RotateSigningSecretRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/RotateSigningSecretRequestBuilder.java @@ -57,7 +57,8 @@ public RotateSigningSecretRequestBuilder id(@Nonnull String id) { return this; } - public RotateSigningSecretRequestBuilder body(@Nullable com.google.genai.gaos.models.webhooks.RotateSigningSecretRequest body) { + public RotateSigningSecretRequestBuilder body( + @Nullable com.google.genai.gaos.models.webhooks.RotateSigningSecretRequest body) { this.pojoBuilder.body(body); this._setterCalled = true; return this; @@ -74,7 +75,7 @@ private RotateSigningSecretRequest _buildRequest() { } return this.request; } - + public RotateSigningSecretRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -83,14 +84,14 @@ public RotateSigningSecretRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public RotateSigningSecretResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new RotateSigningSecret.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new RotateSigningSecret.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/RotateSigningSecretResponse.java b/src/main/java/com/google/genai/gaos/models/operations/RotateSigningSecretResponse.java index fbe83c2460e..0efff73f4c3 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/RotateSigningSecretResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/RotateSigningSecretResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class RotateSigningSecretResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public RotateSigningSecretResponse( @Nonnull HttpResponse rawResponse, @Nullable WebhookRotateSigningSecretResponse webhookRotateSigningSecretResponse) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.webhookRotateSigningSecretResponse = webhookRotateSigningSecretResponse; } - + public RotateSigningSecretResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public RotateSigningSecretResponse withContentType(@Nonnull String contentType) return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public RotateSigningSecretResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,16 +127,15 @@ public RotateSigningSecretResponse withRawResponse(@Nonnull HttpResponse rawResponse) { /** * Successful operation */ - public Builder webhookRotateSigningSecretResponse(@Nullable WebhookRotateSigningSecretResponse webhookRotateSigningSecretResponse) { + public Builder webhookRotateSigningSecretResponse( + @Nullable WebhookRotateSigningSecretResponse webhookRotateSigningSecretResponse) { this.webhookRotateSigningSecretResponse = webhookRotateSigningSecretResponse; return this; } public RotateSigningSecretResponse build() { return new RotateSigningSecretResponse( - contentType, statusCode, rawResponse, - webhookRotateSigningSecretResponse); + contentType, statusCode, rawResponse, webhookRotateSigningSecretResponse); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/RunTriggerRequest.java b/src/main/java/com/google/genai/gaos/models/operations/RunTriggerRequest.java index 5fe41bb34b8..33d7cfcde9c 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/RunTriggerRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/RunTriggerRequest.java @@ -28,7 +28,6 @@ import java.lang.String; import java.util.Optional; - public class RunTriggerRequest { /** * Which version of the API to use. @@ -43,16 +42,13 @@ public class RunTriggerRequest { private String triggerId; @JsonCreator - public RunTriggerRequest( - @Nullable String apiVersion, - @Nonnull String triggerId) { + public RunTriggerRequest(@Nullable String apiVersion, @Nonnull String triggerId) { this.apiVersion = apiVersion; this.triggerId = Optional.ofNullable(triggerId) - .orElseThrow(() -> new IllegalArgumentException("triggerId cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("triggerId cannot be null")); } - - public RunTriggerRequest( - @Nonnull String triggerId) { + + public RunTriggerRequest(@Nonnull String triggerId) { this(null, triggerId); } @@ -74,7 +70,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -83,7 +78,6 @@ public RunTriggerRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * Resource name of the trigger. */ @@ -92,7 +86,6 @@ public RunTriggerRequest withTriggerId(@Nonnull String triggerId) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -102,33 +95,29 @@ public boolean equals(java.lang.Object o) { return false; } RunTriggerRequest other = (RunTriggerRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.triggerId, other.triggerId); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) + && Utils.enhancedDeepEquals(this.triggerId, other.triggerId); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, triggerId); + return Utils.enhancedHash(apiVersion, triggerId); } - + @Override public String toString() { - return Utils.toString(RunTriggerRequest.class, - "apiVersion", apiVersion, - "triggerId", triggerId); + return Utils.toString(RunTriggerRequest.class, "apiVersion", apiVersion, "triggerId", triggerId); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; private String triggerId; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -148,9 +137,7 @@ public Builder triggerId(@Nonnull String triggerId) { } public RunTriggerRequest build() { - return new RunTriggerRequest( - apiVersion, triggerId); + return new RunTriggerRequest(apiVersion, triggerId); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/RunTriggerRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/RunTriggerRequestBuilder.java index 8edbf313027..a7596f0f0e5 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/RunTriggerRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/RunTriggerRequestBuilder.java @@ -68,7 +68,7 @@ private RunTriggerRequest _buildRequest() { } return this.request; } - + public RunTriggerRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -77,14 +77,14 @@ public RunTriggerRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public RunTriggerResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new RunTrigger.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new RunTrigger.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/RunTriggerResponse.java b/src/main/java/com/google/genai/gaos/models/operations/RunTriggerResponse.java index 690f0d78028..50ffee7bd66 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/RunTriggerResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/RunTriggerResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class RunTriggerResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public RunTriggerResponse( @Nonnull HttpResponse rawResponse, @Nullable TriggerExecution triggerExecution) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.triggerExecution = triggerExecution; } - + public RunTriggerResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public RunTriggerResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public RunTriggerResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public RunTriggerResponse withRawResponse(@Nonnull HttpResponse raw return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public RunTriggerResponse withTriggerExecution(@Nullable TriggerExecution trigge return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } RunTriggerResponse other = (RunTriggerResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.triggerExecution, other.triggerExecution); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.triggerExecution, other.triggerExecution); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - triggerExecution); + return Utils.enhancedHash(contentType, statusCode, rawResponse, triggerExecution); } - + @Override public String toString() { - return Utils.toString(RunTriggerResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "triggerExecution", triggerExecution); + return Utils.toString( + RunTriggerResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "triggerExecution", + triggerExecution); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private TriggerExecution triggerExecution; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder triggerExecution(@Nullable TriggerExecution triggerExecution) { } public RunTriggerResponse build() { - return new RunTriggerResponse( - contentType, statusCode, rawResponse, - triggerExecution); + return new RunTriggerResponse(contentType, statusCode, rawResponse, triggerExecution); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/UpdateTriggerRequest.java b/src/main/java/com/google/genai/gaos/models/operations/UpdateTriggerRequest.java index 867287ba675..2f30762cdf8 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/UpdateTriggerRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/UpdateTriggerRequest.java @@ -29,7 +29,6 @@ import java.lang.String; import java.util.Optional; - public class UpdateTriggerRequest { /** * Which version of the API to use. @@ -43,25 +42,17 @@ public class UpdateTriggerRequest { @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") private String id; - @SpeakeasyMetadata("request:mediaType=application/json") private TriggerUpdate body; @JsonCreator - public UpdateTriggerRequest( - @Nullable String apiVersion, - @Nonnull String id, - @Nonnull TriggerUpdate body) { + public UpdateTriggerRequest(@Nullable String apiVersion, @Nonnull String id, @Nonnull TriggerUpdate body) { this.apiVersion = apiVersion; - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); - this.body = Optional.ofNullable(body) - .orElseThrow(() -> new IllegalArgumentException("body cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.body = Optional.ofNullable(body).orElseThrow(() -> new IllegalArgumentException("body cannot be null")); } - - public UpdateTriggerRequest( - @Nonnull String id, - @Nonnull TriggerUpdate body) { + + public UpdateTriggerRequest(@Nonnull String id, @Nonnull TriggerUpdate body) { this(null, id, body); } @@ -87,7 +78,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -96,7 +86,6 @@ public UpdateTriggerRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * Resource name of the trigger. */ @@ -105,13 +94,11 @@ public UpdateTriggerRequest withId(@Nonnull String id) { return this; } - public UpdateTriggerRequest withBody(@Nonnull TriggerUpdate body) { this.body = Utils.checkNotNull(body, "body"); return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -121,28 +108,23 @@ public boolean equals(java.lang.Object o) { return false; } UpdateTriggerRequest other = (UpdateTriggerRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.body, other.body); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) + && Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.body, other.body); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, id, body); + return Utils.enhancedHash(apiVersion, id, body); } - + @Override public String toString() { - return Utils.toString(UpdateTriggerRequest.class, - "apiVersion", apiVersion, - "id", id, - "body", body); + return Utils.toString(UpdateTriggerRequest.class, "apiVersion", apiVersion, "id", id, "body", body); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; @@ -151,7 +133,7 @@ public final static class Builder { private TriggerUpdate body; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -176,9 +158,7 @@ public Builder body(@Nonnull TriggerUpdate body) { } public UpdateTriggerRequest build() { - return new UpdateTriggerRequest( - apiVersion, id, body); + return new UpdateTriggerRequest(apiVersion, id, body); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/UpdateTriggerRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/UpdateTriggerRequestBuilder.java index c2cd565f324..4c759a8e996 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/UpdateTriggerRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/UpdateTriggerRequestBuilder.java @@ -75,7 +75,7 @@ private UpdateTriggerRequest _buildRequest() { } return this.request; } - + public UpdateTriggerRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -84,14 +84,14 @@ public UpdateTriggerRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public UpdateTriggerResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new UpdateTrigger.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new UpdateTrigger.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/UpdateTriggerResponse.java b/src/main/java/com/google/genai/gaos/models/operations/UpdateTriggerResponse.java index 3100f45d4e5..a53d86710f9 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/UpdateTriggerResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/UpdateTriggerResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class UpdateTriggerResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public UpdateTriggerResponse( @Nonnull HttpResponse rawResponse, @Nullable Trigger trigger) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.trigger = trigger; } - + public UpdateTriggerResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public UpdateTriggerResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public UpdateTriggerResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public UpdateTriggerResponse withRawResponse(@Nonnull HttpResponse return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public UpdateTriggerResponse withTrigger(@Nullable Trigger trigger) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } UpdateTriggerResponse other = (UpdateTriggerResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.trigger, other.trigger); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.trigger, other.trigger); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - trigger); + return Utils.enhancedHash(contentType, statusCode, rawResponse, trigger); } - + @Override public String toString() { - return Utils.toString(UpdateTriggerResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "trigger", trigger); + return Utils.toString( + UpdateTriggerResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "trigger", + trigger); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Trigger trigger; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder trigger(@Nullable Trigger trigger) { } public UpdateTriggerResponse build() { - return new UpdateTriggerResponse( - contentType, statusCode, rawResponse, - trigger); + return new UpdateTriggerResponse(contentType, statusCode, rawResponse, trigger); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/UpdateWebhookRequest.java b/src/main/java/com/google/genai/gaos/models/operations/UpdateWebhookRequest.java index 616918d30b4..7fbd47b0bd3 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/UpdateWebhookRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/UpdateWebhookRequest.java @@ -29,7 +29,6 @@ import java.lang.String; import java.util.Optional; - public class UpdateWebhookRequest { /** * Which version of the API to use. @@ -62,16 +61,13 @@ public UpdateWebhookRequest( @Nullable String updateMask, @Nullable WebhookUpdate body) { this.apiVersion = apiVersion; - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); this.updateMask = updateMask; this.body = body; } - - public UpdateWebhookRequest( - @Nonnull String id) { - this(null, id, null, - null); + + public UpdateWebhookRequest(@Nonnull String id) { + this(null, id, null, null); } /** @@ -106,7 +102,6 @@ public static Builder builder() { return new Builder(); } - /** * Which version of the API to use. */ @@ -115,7 +110,6 @@ public UpdateWebhookRequest withApiVersion(@Nullable String apiVersion) { return this; } - /** * Required. The ID of the webhook to update. */ @@ -124,7 +118,6 @@ public UpdateWebhookRequest withId(@Nonnull String id) { return this; } - /** * Optional. The list of fields to update. */ @@ -133,7 +126,6 @@ public UpdateWebhookRequest withUpdateMask(@Nullable String updateMask) { return this; } - /** * Required. The webhook to update. */ @@ -142,7 +134,6 @@ public UpdateWebhookRequest withBody(@Nullable WebhookUpdate body) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -152,31 +143,25 @@ public boolean equals(java.lang.Object o) { return false; } UpdateWebhookRequest other = (UpdateWebhookRequest) o; - return - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.updateMask, other.updateMask) && - Utils.enhancedDeepEquals(this.body, other.body); + return Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) + && Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.updateMask, other.updateMask) + && Utils.enhancedDeepEquals(this.body, other.body); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiVersion, id, updateMask, - body); + return Utils.enhancedHash(apiVersion, id, updateMask, body); } - + @Override public String toString() { - return Utils.toString(UpdateWebhookRequest.class, - "apiVersion", apiVersion, - "id", id, - "updateMask", updateMask, - "body", body); + return Utils.toString( + UpdateWebhookRequest.class, "apiVersion", apiVersion, "id", id, "updateMask", updateMask, "body", body); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiVersion; @@ -187,7 +172,7 @@ public final static class Builder { private WebhookUpdate body; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -223,10 +208,7 @@ public Builder body(@Nullable WebhookUpdate body) { } public UpdateWebhookRequest build() { - return new UpdateWebhookRequest( - apiVersion, id, updateMask, - body); + return new UpdateWebhookRequest(apiVersion, id, updateMask, body); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/UpdateWebhookRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/UpdateWebhookRequestBuilder.java index bda69c74d3a..69d8dbb3212 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/UpdateWebhookRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/UpdateWebhookRequestBuilder.java @@ -81,7 +81,7 @@ private UpdateWebhookRequest _buildRequest() { } return this.request; } - + public UpdateWebhookRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -90,14 +90,14 @@ public UpdateWebhookRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public UpdateWebhookResponse call() { Options options = optionsBuilder.build(); - RequestOperation operation - = new UpdateWebhook.Sync(sdkConfiguration, options, _headers); + RequestOperation operation = + new UpdateWebhook.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(this._buildRequest())); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/UpdateWebhookResponse.java b/src/main/java/com/google/genai/gaos/models/operations/UpdateWebhookResponse.java index c1e2683f589..2d626831796 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/UpdateWebhookResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/UpdateWebhookResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class UpdateWebhookResponse implements Response { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public UpdateWebhookResponse( @Nonnull HttpResponse rawResponse, @Nullable Webhook webhook) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.webhook = webhook; } - + public UpdateWebhookResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public UpdateWebhookResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public UpdateWebhookResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public UpdateWebhookResponse withRawResponse(@Nonnull HttpResponse return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public UpdateWebhookResponse withWebhook(@Nullable Webhook webhook) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } UpdateWebhookResponse other = (UpdateWebhookResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.webhook, other.webhook); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.webhook, other.webhook); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - webhook); + return Utils.enhancedHash(contentType, statusCode, rawResponse, webhook); } - + @Override public String toString() { - return Utils.toString(UpdateWebhookResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "webhook", webhook); + return Utils.toString( + UpdateWebhookResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "webhook", + webhook); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Webhook webhook; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder webhook(@Nullable Webhook webhook) { } public UpdateWebhookResponse build() { - return new UpdateWebhookResponse( - contentType, statusCode, rawResponse, - webhook); + return new UpdateWebhookResponse(contentType, statusCode, rawResponse, webhook); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/CancelInteractionByIdRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/CancelInteractionByIdRequestBuilder.java index 4a90b342882..279621b82a3 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/CancelInteractionByIdRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/CancelInteractionByIdRequestBuilder.java @@ -71,7 +71,7 @@ private CancelInteractionByIdRequest _buildRequest() { } return this.request; } - + public CancelInteractionByIdRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -80,17 +80,16 @@ public CancelInteractionByIdRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new CancelInteractionById.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new CancelInteractionById.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/CancelInteractionByIdResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/CancelInteractionByIdResponse.java index cb78d5d4f5a..b1ecbef8f13 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/CancelInteractionByIdResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/CancelInteractionByIdResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class CancelInteractionByIdResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public CancelInteractionByIdResponse( @Nonnull HttpResponse rawResponse, @Nullable Interaction interaction) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.interaction = interaction; } - + public CancelInteractionByIdResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public CancelInteractionByIdResponse withContentType(@Nonnull String contentType return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public CancelInteractionByIdResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public CancelInteractionByIdResponse withRawResponse(@Nonnull HttpResponse call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new CreateAgent.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new CreateAgent.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/CreateAgentResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/CreateAgentResponse.java index 63091674aa7..95aa5fc1122 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/CreateAgentResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/CreateAgentResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class CreateAgentResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public CreateAgentResponse( @Nonnull HttpResponse rawResponse, @Nullable Agent agent) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.agent = agent; } - + public CreateAgentResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public CreateAgentResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public CreateAgentResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public CreateAgentResponse withRawResponse(@Nonnull HttpResponse ra return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public CreateAgentResponse withAgent(@Nullable Agent agent) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } CreateAgentResponse other = (CreateAgentResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.agent, other.agent); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.agent, other.agent); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - agent); + return Utils.enhancedHash(contentType, statusCode, rawResponse, agent); } - + @Override public String toString() { - return Utils.toString(CreateAgentResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "agent", agent); + return Utils.toString( + CreateAgentResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "agent", + agent); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Agent agent; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder agent(@Nullable Agent agent) { } public CreateAgentResponse build() { - return new CreateAgentResponse( - contentType, statusCode, rawResponse, - agent); + return new CreateAgentResponse(contentType, statusCode, rawResponse, agent); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/CreateEnvironmentRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/CreateEnvironmentRequestBuilder.java index 3940cf426e2..8a9f4a7729d 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/CreateEnvironmentRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/CreateEnvironmentRequestBuilder.java @@ -54,7 +54,8 @@ public CreateEnvironmentRequestBuilder apiVersion(@Nullable String apiVersion) { return this; } - public CreateEnvironmentRequestBuilder body(@Nonnull com.google.genai.gaos.models.environments.CreateEnvironmentRequest body) { + public CreateEnvironmentRequestBuilder body( + @Nonnull com.google.genai.gaos.models.environments.CreateEnvironmentRequest body) { this.pojoBuilder.body(body); this._setterCalled = true; return this; @@ -71,7 +72,7 @@ private CreateEnvironmentRequest _buildRequest() { } return this.request; } - + public CreateEnvironmentRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -80,17 +81,16 @@ public CreateEnvironmentRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new CreateEnvironment.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new CreateEnvironment.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/CreateEnvironmentResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/CreateEnvironmentResponse.java index 436330bed57..7bc0bcd2f3a 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/CreateEnvironmentResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/CreateEnvironmentResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class CreateEnvironmentResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public CreateEnvironmentResponse( @Nonnull HttpResponse rawResponse, @Nullable Environment environment) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.environment = environment; } - + public CreateEnvironmentResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public CreateEnvironmentResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public CreateEnvironmentResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public CreateEnvironmentResponse withRawResponse(@Nonnull HttpResponseThis operation returns a {@link EventStream} blocking SSE (Server-Sent Events) stream. - * - *

- * The returned CompletableFuture completes with the blocking event stream once response headers are received. - * Iterating the stream blocks the calling thread; close it after use. - * - * @return A CompletableFuture that completes with a blocking event stream of typed events from the server. - */ + * Executes the request and returns the response. + * + * + *

This operation returns a {@link EventStream} blocking SSE (Server-Sent Events) stream. + * + *

+ * The returned CompletableFuture completes with the blocking event stream once response headers are received. + * Iterating the stream blocks the calling thread; close it after use. + * + * @return A CompletableFuture that completes with a blocking event stream of typed events from the server. + */ public CompletableFuture> call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new CreateInteraction.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse) - .thenApplyAsync(response -> new EventStream( - response.rawResponse().body(), - new TypeReference() { - }, - Utils.mapper(), - Optional.of("[DONE]")), Operations.streamCompletionExecutor()), operation); + AsyncRequestOperation operation = + new CreateInteraction.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse) + .thenApplyAsync( + response -> new EventStream( + response.rawResponse().body(), + new TypeReference() {}, + Utils.mapper(), + Optional.of("[DONE]")), + Operations.streamCompletionExecutor()), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/CreateInteractionResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/CreateInteractionResponse.java index ec1a05c620c..d302a2856a0 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/CreateInteractionResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/CreateInteractionResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class CreateInteractionResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public CreateInteractionResponse( @Nonnull HttpResponse rawResponse, @Nullable Interaction interaction) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.interaction = interaction; } - + public CreateInteractionResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public CreateInteractionResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public CreateInteractionResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public CreateInteractionResponse withRawResponse(@Nonnull HttpResponse call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new CreateTrigger.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new CreateTrigger.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/CreateTriggerResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/CreateTriggerResponse.java index 40af6d43951..85a3c564885 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/CreateTriggerResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/CreateTriggerResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class CreateTriggerResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public CreateTriggerResponse( @Nonnull HttpResponse rawResponse, @Nullable Trigger trigger) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.trigger = trigger; } - + public CreateTriggerResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public CreateTriggerResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public CreateTriggerResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public CreateTriggerResponse withRawResponse(@Nonnull HttpResponse return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public CreateTriggerResponse withTrigger(@Nullable Trigger trigger) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } CreateTriggerResponse other = (CreateTriggerResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.trigger, other.trigger); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.trigger, other.trigger); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - trigger); + return Utils.enhancedHash(contentType, statusCode, rawResponse, trigger); } - + @Override public String toString() { - return Utils.toString(CreateTriggerResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "trigger", trigger); + return Utils.toString( + CreateTriggerResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "trigger", + trigger); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Trigger trigger; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder trigger(@Nullable Trigger trigger) { } public CreateTriggerResponse build() { - return new CreateTriggerResponse( - contentType, statusCode, rawResponse, - trigger); + return new CreateTriggerResponse(contentType, statusCode, rawResponse, trigger); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/CreateWebhookRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/CreateWebhookRequestBuilder.java index 42b2f5e58f3..53391b97987 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/CreateWebhookRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/CreateWebhookRequestBuilder.java @@ -72,7 +72,7 @@ private CreateWebhookRequest _buildRequest() { } return this.request; } - + public CreateWebhookRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -81,17 +81,16 @@ public CreateWebhookRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new CreateWebhook.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new CreateWebhook.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/CreateWebhookResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/CreateWebhookResponse.java index 220e2f3ae8a..8cc8e04a2f4 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/CreateWebhookResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/CreateWebhookResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class CreateWebhookResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public CreateWebhookResponse( @Nonnull HttpResponse rawResponse, @Nullable Webhook webhook) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.webhook = webhook; } - + public CreateWebhookResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public CreateWebhookResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public CreateWebhookResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public CreateWebhookResponse withRawResponse(@Nonnull HttpResponse return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public CreateWebhookResponse withWebhook(@Nullable Webhook webhook) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } CreateWebhookResponse other = (CreateWebhookResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.webhook, other.webhook); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.webhook, other.webhook); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - webhook); + return Utils.enhancedHash(contentType, statusCode, rawResponse, webhook); } - + @Override public String toString() { - return Utils.toString(CreateWebhookResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "webhook", webhook); + return Utils.toString( + CreateWebhookResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "webhook", + webhook); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Webhook webhook; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder webhook(@Nullable Webhook webhook) { } public CreateWebhookResponse build() { - return new CreateWebhookResponse( - contentType, statusCode, rawResponse, - webhook); + return new CreateWebhookResponse(contentType, statusCode, rawResponse, webhook); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteAgentRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteAgentRequestBuilder.java index 30271824349..ed9b5989142 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteAgentRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteAgentRequestBuilder.java @@ -71,7 +71,7 @@ private DeleteAgentRequest _buildRequest() { } return this.request; } - + public DeleteAgentRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -80,17 +80,16 @@ public DeleteAgentRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new DeleteAgent.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new DeleteAgent.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteAgentResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteAgentResponse.java index f65dd3b0693..fb8acba0f83 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteAgentResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteAgentResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class DeleteAgentResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public DeleteAgentResponse( @Nonnull HttpResponse rawResponse, @Nullable Empty empty) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.empty = empty; } - + public DeleteAgentResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public DeleteAgentResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public DeleteAgentResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public DeleteAgentResponse withRawResponse(@Nonnull HttpResponse ra return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public DeleteAgentResponse withEmpty(@Nullable Empty empty) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } DeleteAgentResponse other = (DeleteAgentResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.empty, other.empty); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.empty, other.empty); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - empty); + return Utils.enhancedHash(contentType, statusCode, rawResponse, empty); } - + @Override public String toString() { - return Utils.toString(DeleteAgentResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "empty", empty); + return Utils.toString( + DeleteAgentResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "empty", + empty); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Empty empty; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder empty(@Nullable Empty empty) { } public DeleteAgentResponse build() { - return new DeleteAgentResponse( - contentType, statusCode, rawResponse, - empty); + return new DeleteAgentResponse(contentType, statusCode, rawResponse, empty); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteEnvironmentRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteEnvironmentRequestBuilder.java index 395257243cc..c38aaf96c4c 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteEnvironmentRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteEnvironmentRequestBuilder.java @@ -71,7 +71,7 @@ private DeleteEnvironmentRequest _buildRequest() { } return this.request; } - + public DeleteEnvironmentRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -80,17 +80,16 @@ public DeleteEnvironmentRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new DeleteEnvironment.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new DeleteEnvironment.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteEnvironmentResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteEnvironmentResponse.java index 421b17330d3..a9ca970c5e0 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteEnvironmentResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteEnvironmentResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class DeleteEnvironmentResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public DeleteEnvironmentResponse( @Nonnull HttpResponse rawResponse, @Nullable Empty empty) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.empty = empty; } - + public DeleteEnvironmentResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public DeleteEnvironmentResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public DeleteEnvironmentResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public DeleteEnvironmentResponse withRawResponse(@Nonnull HttpResponse call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new DeleteInteraction.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new DeleteInteraction.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteInteractionResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteInteractionResponse.java index a3402b72d59..eac1730f7d4 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteInteractionResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteInteractionResponse.java @@ -29,7 +29,6 @@ import java.lang.String; import java.util.Optional; - public class DeleteInteractionResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -48,14 +47,12 @@ public class DeleteInteractionResponse implements AsyncResponse { @JsonCreator public DeleteInteractionResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); } /** @@ -83,7 +80,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -92,7 +88,6 @@ public DeleteInteractionResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -101,7 +96,6 @@ public DeleteInteractionResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -110,7 +104,6 @@ public DeleteInteractionResponse withRawResponse(@Nonnull HttpResponse rawResponse; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -178,9 +173,7 @@ public Builder rawResponse(@Nonnull HttpResponse rawResponse) { } public DeleteInteractionResponse build() { - return new DeleteInteractionResponse( - contentType, statusCode, rawResponse); + return new DeleteInteractionResponse(contentType, statusCode, rawResponse); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteTriggerRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteTriggerRequestBuilder.java index 91225c4b798..e88e6dd73ed 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteTriggerRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteTriggerRequestBuilder.java @@ -71,7 +71,7 @@ private DeleteTriggerRequest _buildRequest() { } return this.request; } - + public DeleteTriggerRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -80,17 +80,16 @@ public DeleteTriggerRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new DeleteTrigger.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new DeleteTrigger.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteTriggerResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteTriggerResponse.java index 371fb625d3e..4efeb6e7c6a 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteTriggerResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteTriggerResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class DeleteTriggerResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public DeleteTriggerResponse( @Nonnull HttpResponse rawResponse, @Nullable Empty empty) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.empty = empty; } - + public DeleteTriggerResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public DeleteTriggerResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public DeleteTriggerResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public DeleteTriggerResponse withRawResponse(@Nonnull HttpResponse return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public DeleteTriggerResponse withEmpty(@Nullable Empty empty) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } DeleteTriggerResponse other = (DeleteTriggerResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.empty, other.empty); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.empty, other.empty); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - empty); + return Utils.enhancedHash(contentType, statusCode, rawResponse, empty); } - + @Override public String toString() { - return Utils.toString(DeleteTriggerResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "empty", empty); + return Utils.toString( + DeleteTriggerResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "empty", + empty); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Empty empty; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder empty(@Nullable Empty empty) { } public DeleteTriggerResponse build() { - return new DeleteTriggerResponse( - contentType, statusCode, rawResponse, - empty); + return new DeleteTriggerResponse(contentType, statusCode, rawResponse, empty); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteWebhookRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteWebhookRequestBuilder.java index 2d4479656b8..143ee4438a6 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteWebhookRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteWebhookRequestBuilder.java @@ -71,7 +71,7 @@ private DeleteWebhookRequest _buildRequest() { } return this.request; } - + public DeleteWebhookRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -80,17 +80,16 @@ public DeleteWebhookRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new DeleteWebhook.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new DeleteWebhook.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteWebhookResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteWebhookResponse.java index b91525bffe7..a25b335fb44 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteWebhookResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteWebhookResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class DeleteWebhookResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public DeleteWebhookResponse( @Nonnull HttpResponse rawResponse, @Nullable Empty empty) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.empty = empty; } - + public DeleteWebhookResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public DeleteWebhookResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public DeleteWebhookResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public DeleteWebhookResponse withRawResponse(@Nonnull HttpResponse return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public DeleteWebhookResponse withEmpty(@Nullable Empty empty) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } DeleteWebhookResponse other = (DeleteWebhookResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.empty, other.empty); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.empty, other.empty); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - empty); + return Utils.enhancedHash(contentType, statusCode, rawResponse, empty); } - + @Override public String toString() { - return Utils.toString(DeleteWebhookResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "empty", empty); + return Utils.toString( + DeleteWebhookResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "empty", + empty); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Empty empty; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder empty(@Nullable Empty empty) { } public DeleteWebhookResponse build() { - return new DeleteWebhookResponse( - contentType, statusCode, rawResponse, - empty); + return new DeleteWebhookResponse(contentType, statusCode, rawResponse, empty); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/GetAgentRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/GetAgentRequestBuilder.java index e48489b195c..f25a44f91df 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/GetAgentRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/GetAgentRequestBuilder.java @@ -71,7 +71,7 @@ private GetAgentRequest _buildRequest() { } return this.request; } - + public GetAgentRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -80,17 +80,16 @@ public GetAgentRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new GetAgent.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new GetAgent.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/GetAgentResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/GetAgentResponse.java index 64ca8568cee..8587027ccb7 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/GetAgentResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/GetAgentResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class GetAgentResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public GetAgentResponse( @Nonnull HttpResponse rawResponse, @Nullable Agent agent) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.agent = agent; } - + public GetAgentResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public GetAgentResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public GetAgentResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public GetAgentResponse withRawResponse(@Nonnull HttpResponse rawRe return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public GetAgentResponse withAgent(@Nullable Agent agent) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } GetAgentResponse other = (GetAgentResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.agent, other.agent); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.agent, other.agent); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - agent); + return Utils.enhancedHash(contentType, statusCode, rawResponse, agent); } - + @Override public String toString() { - return Utils.toString(GetAgentResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "agent", agent); + return Utils.toString( + GetAgentResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "agent", + agent); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Agent agent; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder agent(@Nullable Agent agent) { } public GetAgentResponse build() { - return new GetAgentResponse( - contentType, statusCode, rawResponse, - agent); + return new GetAgentResponse(contentType, statusCode, rawResponse, agent); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/GetEnvironmentRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/GetEnvironmentRequestBuilder.java index 7de7828f9b1..a7ccbed58a6 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/GetEnvironmentRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/GetEnvironmentRequestBuilder.java @@ -71,7 +71,7 @@ private GetEnvironmentRequest _buildRequest() { } return this.request; } - + public GetEnvironmentRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -80,17 +80,16 @@ public GetEnvironmentRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new GetEnvironment.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new GetEnvironment.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/GetEnvironmentResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/GetEnvironmentResponse.java index bac2cc40d73..b2105a5cd89 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/GetEnvironmentResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/GetEnvironmentResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class GetEnvironmentResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public GetEnvironmentResponse( @Nonnull HttpResponse rawResponse, @Nullable Environment environment) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.environment = environment; } - + public GetEnvironmentResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public GetEnvironmentResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public GetEnvironmentResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public GetEnvironmentResponse withRawResponse(@Nonnull HttpResponse return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public GetEnvironmentResponse withEnvironment(@Nullable Environment environment) return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } GetEnvironmentResponse other = (GetEnvironmentResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.environment, other.environment); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.environment, other.environment); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - environment); + return Utils.enhancedHash(contentType, statusCode, rawResponse, environment); } - + @Override public String toString() { - return Utils.toString(GetEnvironmentResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "environment", environment); + return Utils.toString( + GetEnvironmentResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "environment", + environment); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Environment environment; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder environment(@Nullable Environment environment) { } public GetEnvironmentResponse build() { - return new GetEnvironmentResponse( - contentType, statusCode, rawResponse, - environment); + return new GetEnvironmentResponse(contentType, statusCode, rawResponse, environment); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/GetInteractionByIdRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/GetInteractionByIdRequestBuilder.java index c53343c8cfb..2239ed41748 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/GetInteractionByIdRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/GetInteractionByIdRequestBuilder.java @@ -61,7 +61,7 @@ public GetInteractionByIdRequestBuilder request(@Nonnull GetInteractionByIdReque private GetInteractionByIdRequest _buildRequest() { return this.request; } - + public GetInteractionByIdRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -70,30 +70,30 @@ public GetInteractionByIdRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * - *

This operation returns a {@link EventStream} blocking SSE (Server-Sent Events) stream. - * - *

- * The returned CompletableFuture completes with the blocking event stream once response headers are received. - * Iterating the stream blocks the calling thread; close it after use. - * - * @return A CompletableFuture that completes with a blocking event stream of typed events from the server. - */ + * Executes the request and returns the response. + * + * + *

This operation returns a {@link EventStream} blocking SSE (Server-Sent Events) stream. + * + *

+ * The returned CompletableFuture completes with the blocking event stream once response headers are received. + * Iterating the stream blocks the calling thread; close it after use. + * + * @return A CompletableFuture that completes with a blocking event stream of typed events from the server. + */ public CompletableFuture> call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new GetInteractionById.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse) - .thenApplyAsync(response -> new EventStream( - response.rawResponse().body(), - new TypeReference() { - }, - Utils.mapper(), - Optional.of("[DONE]")), Operations.streamCompletionExecutor()), operation); + AsyncRequestOperation operation = + new GetInteractionById.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse) + .thenApplyAsync( + response -> new EventStream( + response.rawResponse().body(), + new TypeReference() {}, + Utils.mapper(), + Optional.of("[DONE]")), + Operations.streamCompletionExecutor()), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/GetInteractionByIdResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/GetInteractionByIdResponse.java index a0f8b8f2588..444cb977b62 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/GetInteractionByIdResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/GetInteractionByIdResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class GetInteractionByIdResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public GetInteractionByIdResponse( @Nonnull HttpResponse rawResponse, @Nullable Interaction interaction) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.interaction = interaction; } - + public GetInteractionByIdResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public GetInteractionByIdResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public GetInteractionByIdResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public GetInteractionByIdResponse withRawResponse(@Nonnull HttpResponse call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new GetTrigger.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new GetTrigger.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/GetTriggerResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/GetTriggerResponse.java index 8b0bb9fad73..6a98af5d183 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/GetTriggerResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/GetTriggerResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class GetTriggerResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public GetTriggerResponse( @Nonnull HttpResponse rawResponse, @Nullable Trigger trigger) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.trigger = trigger; } - + public GetTriggerResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public GetTriggerResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public GetTriggerResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public GetTriggerResponse withRawResponse(@Nonnull HttpResponse raw return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public GetTriggerResponse withTrigger(@Nullable Trigger trigger) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } GetTriggerResponse other = (GetTriggerResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.trigger, other.trigger); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.trigger, other.trigger); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - trigger); + return Utils.enhancedHash(contentType, statusCode, rawResponse, trigger); } - + @Override public String toString() { - return Utils.toString(GetTriggerResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "trigger", trigger); + return Utils.toString( + GetTriggerResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "trigger", + trigger); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Trigger trigger; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder trigger(@Nullable Trigger trigger) { } public GetTriggerResponse build() { - return new GetTriggerResponse( - contentType, statusCode, rawResponse, - trigger); + return new GetTriggerResponse(contentType, statusCode, rawResponse, trigger); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/GetWebhookRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/GetWebhookRequestBuilder.java index c90ac20c48a..2ed97881a5e 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/GetWebhookRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/GetWebhookRequestBuilder.java @@ -71,7 +71,7 @@ private GetWebhookRequest _buildRequest() { } return this.request; } - + public GetWebhookRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -80,17 +80,16 @@ public GetWebhookRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new GetWebhook.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new GetWebhook.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/GetWebhookResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/GetWebhookResponse.java index 4e83714a020..b38d4254291 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/GetWebhookResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/GetWebhookResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class GetWebhookResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public GetWebhookResponse( @Nonnull HttpResponse rawResponse, @Nullable Webhook webhook) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.webhook = webhook; } - + public GetWebhookResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public GetWebhookResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public GetWebhookResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public GetWebhookResponse withRawResponse(@Nonnull HttpResponse raw return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public GetWebhookResponse withWebhook(@Nullable Webhook webhook) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } GetWebhookResponse other = (GetWebhookResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.webhook, other.webhook); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.webhook, other.webhook); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - webhook); + return Utils.enhancedHash(contentType, statusCode, rawResponse, webhook); } - + @Override public String toString() { - return Utils.toString(GetWebhookResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "webhook", webhook); + return Utils.toString( + GetWebhookResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "webhook", + webhook); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Webhook webhook; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder webhook(@Nullable Webhook webhook) { } public GetWebhookResponse build() { - return new GetWebhookResponse( - contentType, statusCode, rawResponse, - webhook); + return new GetWebhookResponse(contentType, statusCode, rawResponse, webhook); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/ListAgentsRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/ListAgentsRequestBuilder.java index 75e94f3ed3c..1fcb82b1494 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/ListAgentsRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/ListAgentsRequestBuilder.java @@ -83,7 +83,7 @@ private ListAgentsRequest _buildRequest() { } return this.request; } - + public ListAgentsRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -92,17 +92,16 @@ public ListAgentsRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new ListAgents.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new ListAgents.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/ListAgentsResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/ListAgentsResponse.java index 393cf39e177..dbc77e25132 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/ListAgentsResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/ListAgentsResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class ListAgentsResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public ListAgentsResponse( @Nonnull HttpResponse rawResponse, @Nullable AgentListResponse agentListResponse) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.agentListResponse = agentListResponse; } - + public ListAgentsResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public ListAgentsResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public ListAgentsResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public ListAgentsResponse withRawResponse(@Nonnull HttpResponse raw return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public ListAgentsResponse withAgentListResponse(@Nullable AgentListResponse agen return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } ListAgentsResponse other = (ListAgentsResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.agentListResponse, other.agentListResponse); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.agentListResponse, other.agentListResponse); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - agentListResponse); + return Utils.enhancedHash(contentType, statusCode, rawResponse, agentListResponse); } - + @Override public String toString() { - return Utils.toString(ListAgentsResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "agentListResponse", agentListResponse); + return Utils.toString( + ListAgentsResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "agentListResponse", + agentListResponse); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private AgentListResponse agentListResponse; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder agentListResponse(@Nullable AgentListResponse agentListResponse) } public ListAgentsResponse build() { - return new ListAgentsResponse( - contentType, statusCode, rawResponse, - agentListResponse); + return new ListAgentsResponse(contentType, statusCode, rawResponse, agentListResponse); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/ListEnvironmentsRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/ListEnvironmentsRequestBuilder.java index 36a74a73c8c..72fb8d0a103 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/ListEnvironmentsRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/ListEnvironmentsRequestBuilder.java @@ -77,7 +77,7 @@ private ListEnvironmentsRequest _buildRequest() { } return this.request; } - + public ListEnvironmentsRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -86,17 +86,16 @@ public ListEnvironmentsRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new ListEnvironments.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new ListEnvironments.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/ListEnvironmentsResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/ListEnvironmentsResponse.java index 8061ba7346f..0507e408641 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/ListEnvironmentsResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/ListEnvironmentsResponse.java @@ -30,7 +30,6 @@ import java.lang.String; import java.util.Optional; - public class ListEnvironmentsResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -59,19 +58,16 @@ public ListEnvironmentsResponse( @Nonnull HttpResponse rawResponse, @Nullable com.google.genai.gaos.models.environments.ListEnvironmentsResponse listEnvironmentsResponse) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.listEnvironmentsResponse = listEnvironmentsResponse; } - + public ListEnvironmentsResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -106,7 +102,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -115,7 +110,6 @@ public ListEnvironmentsResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -124,7 +118,6 @@ public ListEnvironmentsResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -133,16 +126,15 @@ public ListEnvironmentsResponse withRawResponse(@Nonnull HttpResponse rawResponse) { /** * Successful operation */ - public Builder listEnvironmentsResponse(@Nullable com.google.genai.gaos.models.environments.ListEnvironmentsResponse listEnvironmentsResponse) { + public Builder listEnvironmentsResponse( + @Nullable com.google.genai.gaos.models.environments.ListEnvironmentsResponse listEnvironmentsResponse) { this.listEnvironmentsResponse = listEnvironmentsResponse; return this; } public ListEnvironmentsResponse build() { - return new ListEnvironmentsResponse( - contentType, statusCode, rawResponse, - listEnvironmentsResponse); + return new ListEnvironmentsResponse(contentType, statusCode, rawResponse, listEnvironmentsResponse); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/ListTriggerExecutionsRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/ListTriggerExecutionsRequestBuilder.java index 875897a0ec2..58b85cf04b9 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/ListTriggerExecutionsRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/ListTriggerExecutionsRequestBuilder.java @@ -84,7 +84,7 @@ private ListTriggerExecutionsRequest _buildRequest() { } return this.request; } - + public ListTriggerExecutionsRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -93,17 +93,16 @@ public ListTriggerExecutionsRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new ListTriggerExecutions.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new ListTriggerExecutions.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/ListTriggerExecutionsResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/ListTriggerExecutionsResponse.java index bcbdde1dbb5..834d09dd3d4 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/ListTriggerExecutionsResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/ListTriggerExecutionsResponse.java @@ -30,7 +30,6 @@ import java.lang.String; import java.util.Optional; - public class ListTriggerExecutionsResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -59,19 +58,16 @@ public ListTriggerExecutionsResponse( @Nonnull HttpResponse rawResponse, @Nullable com.google.genai.gaos.models.triggers.ListTriggerExecutionsResponse listTriggerExecutionsResponse) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.listTriggerExecutionsResponse = listTriggerExecutionsResponse; } - + public ListTriggerExecutionsResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -106,7 +102,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -115,7 +110,6 @@ public ListTriggerExecutionsResponse withContentType(@Nonnull String contentType return this; } - /** * HTTP response status code for this operation */ @@ -124,7 +118,6 @@ public ListTriggerExecutionsResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -133,16 +126,15 @@ public ListTriggerExecutionsResponse withRawResponse(@Nonnull HttpResponse rawResponse) { /** * Successful operation */ - public Builder listTriggerExecutionsResponse(@Nullable com.google.genai.gaos.models.triggers.ListTriggerExecutionsResponse listTriggerExecutionsResponse) { + public Builder listTriggerExecutionsResponse( + @Nullable com.google.genai.gaos.models.triggers.ListTriggerExecutionsResponse listTriggerExecutionsResponse) { this.listTriggerExecutionsResponse = listTriggerExecutionsResponse; return this; } public ListTriggerExecutionsResponse build() { return new ListTriggerExecutionsResponse( - contentType, statusCode, rawResponse, - listTriggerExecutionsResponse); + contentType, statusCode, rawResponse, listTriggerExecutionsResponse); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/ListTriggersRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/ListTriggersRequestBuilder.java index 0efd2410085..4e9dfcf6dce 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/ListTriggersRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/ListTriggersRequestBuilder.java @@ -83,7 +83,7 @@ private ListTriggersRequest _buildRequest() { } return this.request; } - + public ListTriggersRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -92,17 +92,16 @@ public ListTriggersRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new ListTriggers.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new ListTriggers.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/ListTriggersResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/ListTriggersResponse.java index bd9d86ff2bd..da079d35d3a 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/ListTriggersResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/ListTriggersResponse.java @@ -30,7 +30,6 @@ import java.lang.String; import java.util.Optional; - public class ListTriggersResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -59,19 +58,16 @@ public ListTriggersResponse( @Nonnull HttpResponse rawResponse, @Nullable com.google.genai.gaos.models.triggers.ListTriggersResponse listTriggersResponse) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.listTriggersResponse = listTriggersResponse; } - + public ListTriggersResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -106,7 +102,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -115,7 +110,6 @@ public ListTriggersResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -124,7 +118,6 @@ public ListTriggersResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -133,16 +126,15 @@ public ListTriggersResponse withRawResponse(@Nonnull HttpResponse r return this; } - /** * Successful operation */ - public ListTriggersResponse withListTriggersResponse(@Nullable com.google.genai.gaos.models.triggers.ListTriggersResponse listTriggersResponse) { + public ListTriggersResponse withListTriggersResponse( + @Nullable com.google.genai.gaos.models.triggers.ListTriggersResponse listTriggersResponse) { this.listTriggersResponse = listTriggersResponse; return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -152,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } ListTriggersResponse other = (ListTriggersResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.listTriggersResponse, other.listTriggersResponse); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.listTriggersResponse, other.listTriggersResponse); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - listTriggersResponse); + return Utils.enhancedHash(contentType, statusCode, rawResponse, listTriggersResponse); } - + @Override public String toString() { - return Utils.toString(ListTriggersResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "listTriggersResponse", listTriggersResponse); + return Utils.toString( + ListTriggersResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "listTriggersResponse", + listTriggersResponse); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -187,7 +181,7 @@ public final static class Builder { private com.google.genai.gaos.models.triggers.ListTriggersResponse listTriggersResponse; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -217,16 +211,14 @@ public Builder rawResponse(@Nonnull HttpResponse rawResponse) { /** * Successful operation */ - public Builder listTriggersResponse(@Nullable com.google.genai.gaos.models.triggers.ListTriggersResponse listTriggersResponse) { + public Builder listTriggersResponse( + @Nullable com.google.genai.gaos.models.triggers.ListTriggersResponse listTriggersResponse) { this.listTriggersResponse = listTriggersResponse; return this; } public ListTriggersResponse build() { - return new ListTriggersResponse( - contentType, statusCode, rawResponse, - listTriggersResponse); + return new ListTriggersResponse(contentType, statusCode, rawResponse, listTriggersResponse); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/ListWebhooksRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/ListWebhooksRequestBuilder.java index d9bcc19b9cf..00af4810deb 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/ListWebhooksRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/ListWebhooksRequestBuilder.java @@ -77,7 +77,7 @@ private ListWebhooksRequest _buildRequest() { } return this.request; } - + public ListWebhooksRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -86,17 +86,16 @@ public ListWebhooksRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new ListWebhooks.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new ListWebhooks.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/ListWebhooksResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/ListWebhooksResponse.java index 335b6f94a48..ce4ea894bd4 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/ListWebhooksResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/ListWebhooksResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class ListWebhooksResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public ListWebhooksResponse( @Nonnull HttpResponse rawResponse, @Nullable WebhookListResponse webhookListResponse) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.webhookListResponse = webhookListResponse; } - + public ListWebhooksResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public ListWebhooksResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public ListWebhooksResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public ListWebhooksResponse withRawResponse(@Nonnull HttpResponse r return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public ListWebhooksResponse withWebhookListResponse(@Nullable WebhookListRespons return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } ListWebhooksResponse other = (ListWebhooksResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.webhookListResponse, other.webhookListResponse); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.webhookListResponse, other.webhookListResponse); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - webhookListResponse); + return Utils.enhancedHash(contentType, statusCode, rawResponse, webhookListResponse); } - + @Override public String toString() { - return Utils.toString(ListWebhooksResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "webhookListResponse", webhookListResponse); + return Utils.toString( + ListWebhooksResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "webhookListResponse", + webhookListResponse); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private WebhookListResponse webhookListResponse; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder webhookListResponse(@Nullable WebhookListResponse webhookListResp } public ListWebhooksResponse build() { - return new ListWebhooksResponse( - contentType, statusCode, rawResponse, - webhookListResponse); + return new ListWebhooksResponse(contentType, statusCode, rawResponse, webhookListResponse); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/PingWebhookRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/PingWebhookRequestBuilder.java index 787795baf74..aa27b40fe72 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/PingWebhookRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/PingWebhookRequestBuilder.java @@ -77,7 +77,7 @@ private PingWebhookRequest _buildRequest() { } return this.request; } - + public PingWebhookRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -86,17 +86,16 @@ public PingWebhookRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new PingWebhook.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new PingWebhook.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/PingWebhookResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/PingWebhookResponse.java index 82ec2179791..757415db333 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/PingWebhookResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/PingWebhookResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class PingWebhookResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public PingWebhookResponse( @Nonnull HttpResponse rawResponse, @Nullable WebhookPingResponse webhookPingResponse) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.webhookPingResponse = webhookPingResponse; } - + public PingWebhookResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public PingWebhookResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public PingWebhookResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public PingWebhookResponse withRawResponse(@Nonnull HttpResponse ra return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public PingWebhookResponse withWebhookPingResponse(@Nullable WebhookPingResponse return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } PingWebhookResponse other = (PingWebhookResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.webhookPingResponse, other.webhookPingResponse); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.webhookPingResponse, other.webhookPingResponse); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - webhookPingResponse); + return Utils.enhancedHash(contentType, statusCode, rawResponse, webhookPingResponse); } - + @Override public String toString() { - return Utils.toString(PingWebhookResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "webhookPingResponse", webhookPingResponse); + return Utils.toString( + PingWebhookResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "webhookPingResponse", + webhookPingResponse); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private WebhookPingResponse webhookPingResponse; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder webhookPingResponse(@Nullable WebhookPingResponse webhookPingResp } public PingWebhookResponse build() { - return new PingWebhookResponse( - contentType, statusCode, rawResponse, - webhookPingResponse); + return new PingWebhookResponse(contentType, statusCode, rawResponse, webhookPingResponse); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/RotateSigningSecretRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/RotateSigningSecretRequestBuilder.java index 45320a72842..236de1ab776 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/RotateSigningSecretRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/RotateSigningSecretRequestBuilder.java @@ -60,7 +60,8 @@ public RotateSigningSecretRequestBuilder id(@Nonnull String id) { return this; } - public RotateSigningSecretRequestBuilder body(@Nullable com.google.genai.gaos.models.webhooks.RotateSigningSecretRequest body) { + public RotateSigningSecretRequestBuilder body( + @Nullable com.google.genai.gaos.models.webhooks.RotateSigningSecretRequest body) { this.pojoBuilder.body(body); this._setterCalled = true; return this; @@ -77,7 +78,7 @@ private RotateSigningSecretRequest _buildRequest() { } return this.request; } - + public RotateSigningSecretRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -86,17 +87,16 @@ public RotateSigningSecretRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new RotateSigningSecret.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new RotateSigningSecret.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/RotateSigningSecretResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/RotateSigningSecretResponse.java index 3b61da9b88a..0a0e93ad756 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/RotateSigningSecretResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/RotateSigningSecretResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class RotateSigningSecretResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public RotateSigningSecretResponse( @Nonnull HttpResponse rawResponse, @Nullable WebhookRotateSigningSecretResponse webhookRotateSigningSecretResponse) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.webhookRotateSigningSecretResponse = webhookRotateSigningSecretResponse; } - + public RotateSigningSecretResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public RotateSigningSecretResponse withContentType(@Nonnull String contentType) return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public RotateSigningSecretResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,16 +127,15 @@ public RotateSigningSecretResponse withRawResponse(@Nonnull HttpResponse rawResponse) { /** * Successful operation */ - public Builder webhookRotateSigningSecretResponse(@Nullable WebhookRotateSigningSecretResponse webhookRotateSigningSecretResponse) { + public Builder webhookRotateSigningSecretResponse( + @Nullable WebhookRotateSigningSecretResponse webhookRotateSigningSecretResponse) { this.webhookRotateSigningSecretResponse = webhookRotateSigningSecretResponse; return this; } public RotateSigningSecretResponse build() { return new RotateSigningSecretResponse( - contentType, statusCode, rawResponse, - webhookRotateSigningSecretResponse); + contentType, statusCode, rawResponse, webhookRotateSigningSecretResponse); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/RunTriggerRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/RunTriggerRequestBuilder.java index 8df43c5218f..57dc758befa 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/RunTriggerRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/RunTriggerRequestBuilder.java @@ -71,7 +71,7 @@ private RunTriggerRequest _buildRequest() { } return this.request; } - + public RunTriggerRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -80,17 +80,16 @@ public RunTriggerRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new RunTrigger.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new RunTrigger.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/RunTriggerResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/RunTriggerResponse.java index e1979b5c06e..6154dcef4b6 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/RunTriggerResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/RunTriggerResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class RunTriggerResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public RunTriggerResponse( @Nonnull HttpResponse rawResponse, @Nullable TriggerExecution triggerExecution) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.triggerExecution = triggerExecution; } - + public RunTriggerResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public RunTriggerResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public RunTriggerResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public RunTriggerResponse withRawResponse(@Nonnull HttpResponse raw return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public RunTriggerResponse withTriggerExecution(@Nullable TriggerExecution trigge return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } RunTriggerResponse other = (RunTriggerResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.triggerExecution, other.triggerExecution); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.triggerExecution, other.triggerExecution); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - triggerExecution); + return Utils.enhancedHash(contentType, statusCode, rawResponse, triggerExecution); } - + @Override public String toString() { - return Utils.toString(RunTriggerResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "triggerExecution", triggerExecution); + return Utils.toString( + RunTriggerResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "triggerExecution", + triggerExecution); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private TriggerExecution triggerExecution; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder triggerExecution(@Nullable TriggerExecution triggerExecution) { } public RunTriggerResponse build() { - return new RunTriggerResponse( - contentType, statusCode, rawResponse, - triggerExecution); + return new RunTriggerResponse(contentType, statusCode, rawResponse, triggerExecution); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/UpdateTriggerRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/UpdateTriggerRequestBuilder.java index 87d590e4910..63f87fb28bc 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/UpdateTriggerRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/UpdateTriggerRequestBuilder.java @@ -78,7 +78,7 @@ private UpdateTriggerRequest _buildRequest() { } return this.request; } - + public UpdateTriggerRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -87,17 +87,16 @@ public UpdateTriggerRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new UpdateTrigger.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new UpdateTrigger.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/UpdateTriggerResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/UpdateTriggerResponse.java index 06fac6d3dd6..d5e15e7fef4 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/UpdateTriggerResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/UpdateTriggerResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class UpdateTriggerResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public UpdateTriggerResponse( @Nonnull HttpResponse rawResponse, @Nullable Trigger trigger) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.trigger = trigger; } - + public UpdateTriggerResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public UpdateTriggerResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public UpdateTriggerResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public UpdateTriggerResponse withRawResponse(@Nonnull HttpResponse return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public UpdateTriggerResponse withTrigger(@Nullable Trigger trigger) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } UpdateTriggerResponse other = (UpdateTriggerResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.trigger, other.trigger); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.trigger, other.trigger); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - trigger); + return Utils.enhancedHash(contentType, statusCode, rawResponse, trigger); } - + @Override public String toString() { - return Utils.toString(UpdateTriggerResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "trigger", trigger); + return Utils.toString( + UpdateTriggerResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "trigger", + trigger); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Trigger trigger; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder trigger(@Nullable Trigger trigger) { } public UpdateTriggerResponse build() { - return new UpdateTriggerResponse( - contentType, statusCode, rawResponse, - trigger); + return new UpdateTriggerResponse(contentType, statusCode, rawResponse, trigger); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/UpdateWebhookRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/UpdateWebhookRequestBuilder.java index fd122fe27c7..9b690feb539 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/UpdateWebhookRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/UpdateWebhookRequestBuilder.java @@ -84,7 +84,7 @@ private UpdateWebhookRequest _buildRequest() { } return this.request; } - + public UpdateWebhookRequestBuilder header(String name, String value) { Utils.checkNotNull(name, "name"); Utils.checkNotNull(value, "value"); @@ -93,17 +93,16 @@ public UpdateWebhookRequestBuilder header(String name, String value) { } /** - * Executes the request and returns the response. - * - * @return The response from the server. - */ + * Executes the request and returns the response. + * + * @return The response from the server. + */ public CompletableFuture call() { Options options = optionsBuilder.build(); - AsyncRequestOperation operation - = new UpdateWebhook.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), - operation::handleResponse), operation); + AsyncRequestOperation operation = + new UpdateWebhook.Async(sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); + return Operations.relayCancel( + Operations.applyBodyReadAsync(operation.doRequest(this._buildRequest()), operation::handleResponse), + operation); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/UpdateWebhookResponse.java b/src/main/java/com/google/genai/gaos/models/operations/async/UpdateWebhookResponse.java index a6508e82582..871207d1afd 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/UpdateWebhookResponse.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/UpdateWebhookResponse.java @@ -31,7 +31,6 @@ import java.lang.String; import java.util.Optional; - public class UpdateWebhookResponse implements AsyncResponse { /** * HTTP response content type for this operation @@ -60,19 +59,16 @@ public UpdateWebhookResponse( @Nonnull HttpResponse rawResponse, @Nullable Webhook webhook) { this.contentType = Optional.ofNullable(contentType) - .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("contentType cannot be null")); this.statusCode = statusCode; this.rawResponse = Optional.ofNullable(rawResponse) - .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("rawResponse cannot be null")); this.webhook = webhook; } - + public UpdateWebhookResponse( - @Nonnull String contentType, - int statusCode, - @Nonnull HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, - null); + @Nonnull String contentType, int statusCode, @Nonnull HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, null); } /** @@ -107,7 +103,6 @@ public static Builder builder() { return new Builder(); } - /** * HTTP response content type for this operation */ @@ -116,7 +111,6 @@ public UpdateWebhookResponse withContentType(@Nonnull String contentType) { return this; } - /** * HTTP response status code for this operation */ @@ -125,7 +119,6 @@ public UpdateWebhookResponse withStatusCode(int statusCode) { return this; } - /** * Raw HTTP response; suitable for custom response parsing */ @@ -134,7 +127,6 @@ public UpdateWebhookResponse withRawResponse(@Nonnull HttpResponse return this; } - /** * Successful operation */ @@ -143,7 +135,6 @@ public UpdateWebhookResponse withWebhook(@Nullable Webhook webhook) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,31 +144,33 @@ public boolean equals(java.lang.Object o) { return false; } UpdateWebhookResponse other = (UpdateWebhookResponse) o; - return - Utils.enhancedDeepEquals(this.contentType, other.contentType) && - Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && - Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && - Utils.enhancedDeepEquals(this.webhook, other.webhook); + return Utils.enhancedDeepEquals(this.contentType, other.contentType) + && Utils.enhancedDeepEquals(this.statusCode, other.statusCode) + && Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) + && Utils.enhancedDeepEquals(this.webhook, other.webhook); } - + @Override public int hashCode() { - return Utils.enhancedHash( - contentType, statusCode, rawResponse, - webhook); + return Utils.enhancedHash(contentType, statusCode, rawResponse, webhook); } - + @Override public String toString() { - return Utils.toString(UpdateWebhookResponse.class, - "contentType", contentType, - "statusCode", statusCode, - "rawResponse", rawResponse, - "webhook", webhook); + return Utils.toString( + UpdateWebhookResponse.class, + "contentType", + contentType, + "statusCode", + statusCode, + "rawResponse", + rawResponse, + "webhook", + webhook); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String contentType; @@ -188,7 +181,7 @@ public final static class Builder { private Webhook webhook; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -224,10 +217,7 @@ public Builder webhook(@Nullable Webhook webhook) { } public UpdateWebhookResponse build() { - return new UpdateWebhookResponse( - contentType, statusCode, rawResponse, - webhook); + return new UpdateWebhookResponse(contentType, statusCode, rawResponse, webhook); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/shared/Security.java b/src/main/java/com/google/genai/gaos/models/shared/Security.java index 5ce90457094..8596a98eeef 100644 --- a/src/main/java/com/google/genai/gaos/models/shared/Security.java +++ b/src/main/java/com/google/genai/gaos/models/shared/Security.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.shared; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.HasSecurity; import com.google.genai.gaos.utils.SpeakeasyMetadata; @@ -32,7 +32,6 @@ import java.util.Map; import java.util.Optional; - public class Security implements HasSecurity { /** * Gemini API key sent as x-goog-api-key. @@ -67,7 +66,7 @@ public Security( this.accessToken = accessToken; this.defaultHeaders = defaultHeaders; } - + public Security() { this(null, null, null); } @@ -97,7 +96,6 @@ public static Builder builder() { return new Builder(); } - /** * Gemini API key sent as x-goog-api-key. */ @@ -106,7 +104,6 @@ public Security withApiKey(@Nullable String apiKey) { return this; } - /** * OAuth access token sent as a bearer Authorization header. */ @@ -115,7 +112,6 @@ public Security withAccessToken(@Nullable String accessToken) { return this; } - /** * Additional default headers to apply before request-specific headers and auth. */ @@ -124,7 +120,6 @@ public Security withDefaultHeaders(@Nullable Map defaultHeaders) return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -134,28 +129,24 @@ public boolean equals(java.lang.Object o) { return false; } Security other = (Security) o; - return - Utils.enhancedDeepEquals(this.apiKey, other.apiKey) && - Utils.enhancedDeepEquals(this.accessToken, other.accessToken) && - Utils.enhancedDeepEquals(this.defaultHeaders, other.defaultHeaders); + return Utils.enhancedDeepEquals(this.apiKey, other.apiKey) + && Utils.enhancedDeepEquals(this.accessToken, other.accessToken) + && Utils.enhancedDeepEquals(this.defaultHeaders, other.defaultHeaders); } - + @Override public int hashCode() { - return Utils.enhancedHash( - apiKey, accessToken, defaultHeaders); + return Utils.enhancedHash(apiKey, accessToken, defaultHeaders); } - + @Override public String toString() { - return Utils.toString(Security.class, - "apiKey", apiKey, - "accessToken", accessToken, - "defaultHeaders", defaultHeaders); + return Utils.toString( + Security.class, "apiKey", apiKey, "accessToken", accessToken, "defaultHeaders", defaultHeaders); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String apiKey; @@ -164,7 +155,7 @@ public final static class Builder { private Map defaultHeaders; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -192,9 +183,7 @@ public Builder defaultHeaders(@Nullable Map defaultHeaders) { } public Security build() { - return new Security( - apiKey, accessToken, defaultHeaders); + return new Security(apiKey, accessToken, defaultHeaders); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/triggers/Interaction.java b/src/main/java/com/google/genai/gaos/models/triggers/Interaction.java index 3d80ebbe1d8..28ee919768c 100644 --- a/src/main/java/com/google/genai/gaos/models/triggers/Interaction.java +++ b/src/main/java/com/google/genai/gaos/models/triggers/Interaction.java @@ -27,9 +27,9 @@ import com.google.genai.gaos.models.interactions.CreateModelInteraction; import com.google.genai.gaos.utils.OneOfDeserializer; import com.google.genai.gaos.utils.TypedObject; +import com.google.genai.gaos.utils.Utils; import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape; -import com.google.genai.gaos.utils.Utils; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; @@ -37,7 +37,7 @@ /** * Interaction - * + * *

Required. The interaction request template to be executed. */ @JsonDeserialize(using = Interaction._Deserializer.class) @@ -45,21 +45,21 @@ public class Interaction { @JsonValue private final TypedObject value; - + private Interaction(TypedObject value) { this.value = value; } public static Interaction of(CreateAgentInteraction value) { Utils.checkNotNull(value, "value"); - return new Interaction(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new Interaction(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } public static Interaction of(CreateModelInteraction value) { Utils.checkNotNull(value, "value"); - return new Interaction(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new Interaction(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference() {})); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code CreateAgentInteraction}, * otherwise returns an empty {@link Optional}. @@ -72,7 +72,7 @@ public Optional createAgentInteraction() { } return Optional.empty(); } - + /** * Returns an {@link Optional} containing the value if it is of type {@code CreateModelInteraction}, * otherwise returns an empty {@link Optional}. @@ -85,19 +85,19 @@ public Optional createModelInteraction() { } return Optional.empty(); } - /** - * Returns an {@link Optional} containing the value as a {@code JsonNode}. - * This accessor returns the raw JSON when the value doesn't match any of the defined union types. - * - * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type - */ - public Optional asJson() { - if (value.value() instanceof JsonNode) { - return Optional.of((JsonNode) value.value()); - } - return Optional.empty(); - } - + /** + * Returns an {@link Optional} containing the value as a {@code JsonNode}. + * This accessor returns the raw JSON when the value doesn't match any of the defined union types. + * + * @return an {@link Optional} containing the {@code JsonNode} value, or empty if value matched a known type + */ + public Optional asJson() { + if (value.value() instanceof JsonNode) { + return Optional.of((JsonNode) value.value()); + } + return Optional.empty(); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -109,27 +109,26 @@ public boolean equals(java.lang.Object o) { Interaction other = (Interaction) o; return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } - + @Override public int hashCode() { return Utils.enhancedHash(value.value()); } - + @SuppressWarnings("serial") public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { - super(Interaction.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + super( + Interaction.class, + false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } - + @Override public String toString() { - return Utils.toString(Interaction.class, - "value", value); + return Utils.toString(Interaction.class, "value", value); } - } - diff --git a/src/main/java/com/google/genai/gaos/models/triggers/ListTriggerExecutionsResponse.java b/src/main/java/com/google/genai/gaos/models/triggers/ListTriggerExecutionsResponse.java index 774c2901b0c..d7b137ac5b2 100644 --- a/src/main/java/com/google/genai/gaos/models/triggers/ListTriggerExecutionsResponse.java +++ b/src/main/java/com/google/genai/gaos/models/triggers/ListTriggerExecutionsResponse.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.triggers; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * ListTriggerExecutionsResponse - * + * *

Response message for TriggerService.ListTriggerExecutions. */ public class ListTriggerExecutionsResponse { @@ -58,7 +58,7 @@ public ListTriggerExecutionsResponse( this.nextPageToken = nextPageToken; this.triggerExecutions = triggerExecutions; } - + public ListTriggerExecutionsResponse() { this(null, null); } @@ -82,7 +82,6 @@ public static Builder builder() { return new Builder(); } - /** * A page token, received from a previous `ListTriggerExecutions` call. * Provide this to retrieve the subsequent page. @@ -92,7 +91,6 @@ public ListTriggerExecutionsResponse withNextPageToken(@Nullable String nextPage return this; } - /** * The list of trigger executions. */ @@ -101,7 +99,6 @@ public ListTriggerExecutionsResponse withTriggerExecutions(@Nullable List triggerExecutions; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -158,9 +156,7 @@ public Builder triggerExecutions(@Nullable List triggerExecuti } public ListTriggerExecutionsResponse build() { - return new ListTriggerExecutionsResponse( - nextPageToken, triggerExecutions); + return new ListTriggerExecutionsResponse(nextPageToken, triggerExecutions); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/triggers/ListTriggersResponse.java b/src/main/java/com/google/genai/gaos/models/triggers/ListTriggersResponse.java index b2e711f1e9c..7f7361bd15d 100644 --- a/src/main/java/com/google/genai/gaos/models/triggers/ListTriggersResponse.java +++ b/src/main/java/com/google/genai/gaos/models/triggers/ListTriggersResponse.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.triggers; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * ListTriggersResponse - * + * *

Response message for TriggerService.ListTriggers. */ public class ListTriggersResponse { @@ -58,7 +58,7 @@ public ListTriggersResponse( this.nextPageToken = nextPageToken; this.triggers = triggers; } - + public ListTriggersResponse() { this(null, null); } @@ -82,7 +82,6 @@ public static Builder builder() { return new Builder(); } - /** * A page token, received from a previous `ListTriggers` call. * Provide this to retrieve the subsequent page. @@ -92,7 +91,6 @@ public ListTriggersResponse withNextPageToken(@Nullable String nextPageToken) { return this; } - /** * The list of triggers. */ @@ -101,7 +99,6 @@ public ListTriggersResponse withTriggers(@Nullable List triggers) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -111,33 +108,29 @@ public boolean equals(java.lang.Object o) { return false; } ListTriggersResponse other = (ListTriggersResponse) o; - return - Utils.enhancedDeepEquals(this.nextPageToken, other.nextPageToken) && - Utils.enhancedDeepEquals(this.triggers, other.triggers); + return Utils.enhancedDeepEquals(this.nextPageToken, other.nextPageToken) + && Utils.enhancedDeepEquals(this.triggers, other.triggers); } - + @Override public int hashCode() { - return Utils.enhancedHash( - nextPageToken, triggers); + return Utils.enhancedHash(nextPageToken, triggers); } - + @Override public String toString() { - return Utils.toString(ListTriggersResponse.class, - "nextPageToken", nextPageToken, - "triggers", triggers); + return Utils.toString(ListTriggersResponse.class, "nextPageToken", nextPageToken, "triggers", triggers); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String nextPageToken; private List triggers; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -158,9 +151,7 @@ public Builder triggers(@Nullable List triggers) { } public ListTriggersResponse build() { - return new ListTriggersResponse( - nextPageToken, triggers); + return new ListTriggersResponse(nextPageToken, triggers); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/triggers/Trigger.java b/src/main/java/com/google/genai/gaos/models/triggers/Trigger.java index 465f32d85be..adf6cf5d64d 100644 --- a/src/main/java/com/google/genai/gaos/models/triggers/Trigger.java +++ b/src/main/java/com/google/genai/gaos/models/triggers/Trigger.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.triggers; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.models.interactions.Interaction; import com.google.genai.gaos.utils.Utils; @@ -35,7 +35,7 @@ /** * Trigger - * + * *

A trigger configuration that is scheduled to run an agent. */ public class Trigger { @@ -77,7 +77,7 @@ public class Trigger { /** * Required. Output only. Identifier. - * + * *

The ID of the trigger. */ @JsonProperty("id") @@ -183,10 +183,9 @@ public Trigger( this.displayName = displayName; this.environmentId = environmentId; this.executionTimeoutSeconds = executionTimeoutSeconds; - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); this.interaction = Optional.ofNullable(interaction) - .orElseThrow(() -> new IllegalArgumentException("interaction cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("interaction cannot be null")); this.lastPauseTime = lastPauseTime; this.lastResumeTime = lastResumeTime; this.lastRunTime = lastRunTime; @@ -194,24 +193,33 @@ public Trigger( this.nextRunTime = nextRunTime; this.previousInteractionId = previousInteractionId; this.schedule = Optional.ofNullable(schedule) - .orElseThrow(() -> new IllegalArgumentException("schedule cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("schedule cannot be null")); this.status = status; this.timeZone = Optional.ofNullable(timeZone) - .orElseThrow(() -> new IllegalArgumentException("timeZone cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("timeZone cannot be null")); this.updateTime = updateTime; } - + public Trigger( - @Nonnull String id, - @Nonnull Interaction interaction, - @Nonnull String schedule, - @Nonnull String timeZone) { - this(null, null, null, - null, null, id, - interaction, null, null, - null, null, null, - null, schedule, null, - timeZone, null); + @Nonnull String id, @Nonnull Interaction interaction, @Nonnull String schedule, @Nonnull String timeZone) { + this( + null, + null, + null, + null, + null, + id, + interaction, + null, + null, + null, + null, + null, + null, + schedule, + null, + timeZone, + null); } /** @@ -252,7 +260,7 @@ public Optional executionTimeoutSeconds() { /** * Required. Output only. Identifier. - * + * *

The ID of the trigger. */ public Optional id() { @@ -342,7 +350,6 @@ public static Builder builder() { return new Builder(); } - /** * Output only. The number of consecutive failures that have occurred * since the last successful execution. @@ -352,7 +359,6 @@ public Trigger withConsecutiveFailureCount(@Nullable Integer consecutiveFailureC return this; } - /** * Output only. The time when the trigger was created. */ @@ -361,7 +367,6 @@ public Trigger withCreateTime(@Nullable OffsetDateTime createTime) { return this; } - /** * Optional. The display name of the trigger. */ @@ -370,7 +375,6 @@ public Trigger withDisplayName(@Nullable String displayName) { return this; } - /** * Optional. The environment ID for the trigger execution. */ @@ -379,7 +383,6 @@ public Trigger withEnvironmentId(@Nullable String environmentId) { return this; } - /** * Optional. The execution timeout for the triggered interaction. */ @@ -388,10 +391,9 @@ public Trigger withExecutionTimeoutSeconds(@Nullable Integer executionTimeoutSec return this; } - /** * Required. Output only. Identifier. - * + * *

The ID of the trigger. */ public Trigger withId(@Nonnull String id) { @@ -399,7 +401,6 @@ public Trigger withId(@Nonnull String id) { return this; } - /** * The Interaction resource. */ @@ -408,7 +409,6 @@ public Trigger withInteraction(@Nonnull Interaction interaction) { return this; } - /** * Output only. The time when the trigger was last paused. */ @@ -417,7 +417,6 @@ public Trigger withLastPauseTime(@Nullable OffsetDateTime lastPauseTime) { return this; } - /** * Output only. The time when the trigger was last resumed. */ @@ -426,7 +425,6 @@ public Trigger withLastResumeTime(@Nullable OffsetDateTime lastResumeTime) { return this; } - /** * Output only. The time when the trigger was last run. */ @@ -435,7 +433,6 @@ public Trigger withLastRunTime(@Nullable OffsetDateTime lastRunTime) { return this; } - /** * Optional. The maximum number of consecutive failures allowed before * the trigger is automatically paused (status becomes ERROR). @@ -445,7 +442,6 @@ public Trigger withMaxConsecutiveFailures(@Nullable Integer maxConsecutiveFailur return this; } - /** * Output only. The time when the trigger is scheduled to run next. */ @@ -454,7 +450,6 @@ public Trigger withNextRunTime(@Nullable OffsetDateTime nextRunTime) { return this; } - /** * Output only. The ID of the last interaction created by this trigger. */ @@ -463,7 +458,6 @@ public Trigger withPreviousInteractionId(@Nullable String previousInteractionId) return this; } - /** * Required. The cron schedule on which the trigger should run. * Standard cron format. @@ -473,7 +467,6 @@ public Trigger withSchedule(@Nonnull String schedule) { return this; } - /** * Output only. The current status of the trigger. */ @@ -482,7 +475,6 @@ public Trigger withStatus(@Nullable TriggerStatus status) { return this; } - /** * Required. Time zone in which the schedule should be interpreted. */ @@ -491,7 +483,6 @@ public Trigger withTimeZone(@Nonnull String timeZone) { return this; } - /** * Output only. The time when the trigger was last updated. */ @@ -500,7 +491,6 @@ public Trigger withUpdateTime(@Nullable OffsetDateTime updateTime) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -510,61 +500,89 @@ public boolean equals(java.lang.Object o) { return false; } Trigger other = (Trigger) o; - return - Utils.enhancedDeepEquals(this.consecutiveFailureCount, other.consecutiveFailureCount) && - Utils.enhancedDeepEquals(this.createTime, other.createTime) && - Utils.enhancedDeepEquals(this.displayName, other.displayName) && - Utils.enhancedDeepEquals(this.environmentId, other.environmentId) && - Utils.enhancedDeepEquals(this.executionTimeoutSeconds, other.executionTimeoutSeconds) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.interaction, other.interaction) && - Utils.enhancedDeepEquals(this.lastPauseTime, other.lastPauseTime) && - Utils.enhancedDeepEquals(this.lastResumeTime, other.lastResumeTime) && - Utils.enhancedDeepEquals(this.lastRunTime, other.lastRunTime) && - Utils.enhancedDeepEquals(this.maxConsecutiveFailures, other.maxConsecutiveFailures) && - Utils.enhancedDeepEquals(this.nextRunTime, other.nextRunTime) && - Utils.enhancedDeepEquals(this.previousInteractionId, other.previousInteractionId) && - Utils.enhancedDeepEquals(this.schedule, other.schedule) && - Utils.enhancedDeepEquals(this.status, other.status) && - Utils.enhancedDeepEquals(this.timeZone, other.timeZone) && - Utils.enhancedDeepEquals(this.updateTime, other.updateTime); - } - + return Utils.enhancedDeepEquals(this.consecutiveFailureCount, other.consecutiveFailureCount) + && Utils.enhancedDeepEquals(this.createTime, other.createTime) + && Utils.enhancedDeepEquals(this.displayName, other.displayName) + && Utils.enhancedDeepEquals(this.environmentId, other.environmentId) + && Utils.enhancedDeepEquals(this.executionTimeoutSeconds, other.executionTimeoutSeconds) + && Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.interaction, other.interaction) + && Utils.enhancedDeepEquals(this.lastPauseTime, other.lastPauseTime) + && Utils.enhancedDeepEquals(this.lastResumeTime, other.lastResumeTime) + && Utils.enhancedDeepEquals(this.lastRunTime, other.lastRunTime) + && Utils.enhancedDeepEquals(this.maxConsecutiveFailures, other.maxConsecutiveFailures) + && Utils.enhancedDeepEquals(this.nextRunTime, other.nextRunTime) + && Utils.enhancedDeepEquals(this.previousInteractionId, other.previousInteractionId) + && Utils.enhancedDeepEquals(this.schedule, other.schedule) + && Utils.enhancedDeepEquals(this.status, other.status) + && Utils.enhancedDeepEquals(this.timeZone, other.timeZone) + && Utils.enhancedDeepEquals(this.updateTime, other.updateTime); + } + @Override public int hashCode() { return Utils.enhancedHash( - consecutiveFailureCount, createTime, displayName, - environmentId, executionTimeoutSeconds, id, - interaction, lastPauseTime, lastResumeTime, - lastRunTime, maxConsecutiveFailures, nextRunTime, - previousInteractionId, schedule, status, - timeZone, updateTime); - } - + consecutiveFailureCount, + createTime, + displayName, + environmentId, + executionTimeoutSeconds, + id, + interaction, + lastPauseTime, + lastResumeTime, + lastRunTime, + maxConsecutiveFailures, + nextRunTime, + previousInteractionId, + schedule, + status, + timeZone, + updateTime); + } + @Override public String toString() { - return Utils.toString(Trigger.class, - "consecutiveFailureCount", consecutiveFailureCount, - "createTime", createTime, - "displayName", displayName, - "environmentId", environmentId, - "executionTimeoutSeconds", executionTimeoutSeconds, - "id", id, - "interaction", interaction, - "lastPauseTime", lastPauseTime, - "lastResumeTime", lastResumeTime, - "lastRunTime", lastRunTime, - "maxConsecutiveFailures", maxConsecutiveFailures, - "nextRunTime", nextRunTime, - "previousInteractionId", previousInteractionId, - "schedule", schedule, - "status", status, - "timeZone", timeZone, - "updateTime", updateTime); + return Utils.toString( + Trigger.class, + "consecutiveFailureCount", + consecutiveFailureCount, + "createTime", + createTime, + "displayName", + displayName, + "environmentId", + environmentId, + "executionTimeoutSeconds", + executionTimeoutSeconds, + "id", + id, + "interaction", + interaction, + "lastPauseTime", + lastPauseTime, + "lastResumeTime", + lastResumeTime, + "lastRunTime", + lastRunTime, + "maxConsecutiveFailures", + maxConsecutiveFailures, + "nextRunTime", + nextRunTime, + "previousInteractionId", + previousInteractionId, + "schedule", + schedule, + "status", + status, + "timeZone", + timeZone, + "updateTime", + updateTime); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Integer consecutiveFailureCount; @@ -601,7 +619,7 @@ public final static class Builder { private OffsetDateTime updateTime; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -647,7 +665,7 @@ public Builder executionTimeoutSeconds(@Nullable Integer executionTimeoutSeconds /** * Required. Output only. Identifier. - * + * *

The ID of the trigger. */ public Builder id(@Nonnull String id) { @@ -747,13 +765,23 @@ public Builder updateTime(@Nullable OffsetDateTime updateTime) { public Trigger build() { return new Trigger( - consecutiveFailureCount, createTime, displayName, - environmentId, executionTimeoutSeconds, id, - interaction, lastPauseTime, lastResumeTime, - lastRunTime, maxConsecutiveFailures, nextRunTime, - previousInteractionId, schedule, status, - timeZone, updateTime); + consecutiveFailureCount, + createTime, + displayName, + environmentId, + executionTimeoutSeconds, + id, + interaction, + lastPauseTime, + lastResumeTime, + lastRunTime, + maxConsecutiveFailures, + nextRunTime, + previousInteractionId, + schedule, + status, + timeZone, + updateTime); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/triggers/TriggerCreateParams.java b/src/main/java/com/google/genai/gaos/models/triggers/TriggerCreateParams.java index b36bf006161..e8928a45b9c 100644 --- a/src/main/java/com/google/genai/gaos/models/triggers/TriggerCreateParams.java +++ b/src/main/java/com/google/genai/gaos/models/triggers/TriggerCreateParams.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.triggers; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nonnull; @@ -33,7 +33,7 @@ /** * TriggerCreateParams - * + * *

Parameters for creating a trigger. */ public class TriggerCreateParams { @@ -94,24 +94,19 @@ public TriggerCreateParams( @JsonProperty("execution_timeout_seconds") @Nullable Integer executionTimeoutSeconds, @JsonProperty("interaction") @Nonnull Interaction interaction) { this.schedule = Optional.ofNullable(schedule) - .orElseThrow(() -> new IllegalArgumentException("schedule cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("schedule cannot be null")); this.timeZone = Optional.ofNullable(timeZone) - .orElseThrow(() -> new IllegalArgumentException("timeZone cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("timeZone cannot be null")); this.displayName = displayName; this.environmentId = environmentId; this.maxConsecutiveFailures = maxConsecutiveFailures; this.executionTimeoutSeconds = executionTimeoutSeconds; this.interaction = Optional.ofNullable(interaction) - .orElseThrow(() -> new IllegalArgumentException("interaction cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("interaction cannot be null")); } - - public TriggerCreateParams( - @Nonnull String schedule, - @Nonnull String timeZone, - @Nonnull Interaction interaction) { - this(schedule, timeZone, null, - null, null, null, - interaction); + + public TriggerCreateParams(@Nonnull String schedule, @Nonnull String timeZone, @Nonnull Interaction interaction) { + this(schedule, timeZone, null, null, null, null, interaction); } /** @@ -168,7 +163,6 @@ public static Builder builder() { return new Builder(); } - /** * Required. The cron schedule on which the trigger should run. Standard cron format. */ @@ -177,7 +171,6 @@ public TriggerCreateParams withSchedule(@Nonnull String schedule) { return this; } - /** * Required. Time zone in which the schedule should be interpreted. */ @@ -186,7 +179,6 @@ public TriggerCreateParams withTimeZone(@Nonnull String timeZone) { return this; } - /** * Optional. The display name of the trigger. */ @@ -195,7 +187,6 @@ public TriggerCreateParams withDisplayName(@Nullable String displayName) { return this; } - /** * Optional. The environment ID for the trigger execution. */ @@ -204,7 +195,6 @@ public TriggerCreateParams withEnvironmentId(@Nullable String environmentId) { return this; } - /** * Optional. The maximum number of consecutive failures allowed before the trigger is automatically * paused (status becomes ERROR). @@ -214,7 +204,6 @@ public TriggerCreateParams withMaxConsecutiveFailures(@Nullable Integer maxConse return this; } - /** * Optional. The execution timeout for the triggered interaction. */ @@ -223,7 +212,6 @@ public TriggerCreateParams withExecutionTimeoutSeconds(@Nullable Integer executi return this; } - /** * Required. The interaction request template to be executed. */ @@ -232,7 +220,6 @@ public TriggerCreateParams withInteraction(@Nonnull Interaction interaction) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -242,38 +229,49 @@ public boolean equals(java.lang.Object o) { return false; } TriggerCreateParams other = (TriggerCreateParams) o; - return - Utils.enhancedDeepEquals(this.schedule, other.schedule) && - Utils.enhancedDeepEquals(this.timeZone, other.timeZone) && - Utils.enhancedDeepEquals(this.displayName, other.displayName) && - Utils.enhancedDeepEquals(this.environmentId, other.environmentId) && - Utils.enhancedDeepEquals(this.maxConsecutiveFailures, other.maxConsecutiveFailures) && - Utils.enhancedDeepEquals(this.executionTimeoutSeconds, other.executionTimeoutSeconds) && - Utils.enhancedDeepEquals(this.interaction, other.interaction); + return Utils.enhancedDeepEquals(this.schedule, other.schedule) + && Utils.enhancedDeepEquals(this.timeZone, other.timeZone) + && Utils.enhancedDeepEquals(this.displayName, other.displayName) + && Utils.enhancedDeepEquals(this.environmentId, other.environmentId) + && Utils.enhancedDeepEquals(this.maxConsecutiveFailures, other.maxConsecutiveFailures) + && Utils.enhancedDeepEquals(this.executionTimeoutSeconds, other.executionTimeoutSeconds) + && Utils.enhancedDeepEquals(this.interaction, other.interaction); } - + @Override public int hashCode() { return Utils.enhancedHash( - schedule, timeZone, displayName, - environmentId, maxConsecutiveFailures, executionTimeoutSeconds, - interaction); + schedule, + timeZone, + displayName, + environmentId, + maxConsecutiveFailures, + executionTimeoutSeconds, + interaction); } - + @Override public String toString() { - return Utils.toString(TriggerCreateParams.class, - "schedule", schedule, - "timeZone", timeZone, - "displayName", displayName, - "environmentId", environmentId, - "maxConsecutiveFailures", maxConsecutiveFailures, - "executionTimeoutSeconds", executionTimeoutSeconds, - "interaction", interaction); + return Utils.toString( + TriggerCreateParams.class, + "schedule", + schedule, + "timeZone", + timeZone, + "displayName", + displayName, + "environmentId", + environmentId, + "maxConsecutiveFailures", + maxConsecutiveFailures, + "executionTimeoutSeconds", + executionTimeoutSeconds, + "interaction", + interaction); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String schedule; @@ -290,7 +288,7 @@ public final static class Builder { private Interaction interaction; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -352,10 +350,13 @@ public Builder interaction(@Nonnull Interaction interaction) { public TriggerCreateParams build() { return new TriggerCreateParams( - schedule, timeZone, displayName, - environmentId, maxConsecutiveFailures, executionTimeoutSeconds, - interaction); + schedule, + timeZone, + displayName, + environmentId, + maxConsecutiveFailures, + executionTimeoutSeconds, + interaction); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/triggers/TriggerExecution.java b/src/main/java/com/google/genai/gaos/models/triggers/TriggerExecution.java index 2bbd239d128..1689dd320bf 100644 --- a/src/main/java/com/google/genai/gaos/models/triggers/TriggerExecution.java +++ b/src/main/java/com/google/genai/gaos/models/triggers/TriggerExecution.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.triggers; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nonnull; @@ -33,7 +33,7 @@ /** * TriggerExecution - * + * *

An execution instance of a trigger. */ public class TriggerExecution { @@ -60,7 +60,7 @@ public class TriggerExecution { /** * Required. Output only. Identifier. - * + * *

The ID of the trigger execution. */ @JsonProperty("id") @@ -96,7 +96,7 @@ public class TriggerExecution { /** * Required. Output only. Identifier. - * + * *

The ID of the trigger that created this execution. */ @JsonProperty("trigger_id") @@ -116,22 +116,17 @@ public TriggerExecution( this.endTime = endTime; this.environmentId = environmentId; this.error = error; - this.id = Optional.ofNullable(id) - .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); + this.id = Optional.ofNullable(id).orElseThrow(() -> new IllegalArgumentException("id cannot be null")); this.interactionId = interactionId; this.scheduledTime = scheduledTime; this.startTime = startTime; this.status = status; this.triggerId = Optional.ofNullable(triggerId) - .orElseThrow(() -> new IllegalArgumentException("triggerId cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("triggerId cannot be null")); } - - public TriggerExecution( - @Nonnull String id, - @Nonnull String triggerId) { - this(null, null, null, - id, null, null, - null, null, triggerId); + + public TriggerExecution(@Nonnull String id, @Nonnull String triggerId) { + this(null, null, null, id, null, null, null, null, triggerId); } /** @@ -157,7 +152,7 @@ public Optional error() { /** * Required. Output only. Identifier. - * + * *

The ID of the trigger execution. */ public Optional id() { @@ -194,7 +189,7 @@ public Optional status() { /** * Required. Output only. Identifier. - * + * *

The ID of the trigger that created this execution. */ public Optional triggerId() { @@ -205,7 +200,6 @@ public static Builder builder() { return new Builder(); } - /** * Output only. The time when the execution finished. */ @@ -214,7 +208,6 @@ public TriggerExecution withEndTime(@Nullable OffsetDateTime endTime) { return this; } - /** * Output only. The environment ID used for the execution. */ @@ -223,7 +216,6 @@ public TriggerExecution withEnvironmentId(@Nullable String environmentId) { return this; } - /** * Output only. The error message if the execution failed. */ @@ -232,10 +224,9 @@ public TriggerExecution withError(@Nullable String error) { return this; } - /** * Required. Output only. Identifier. - * + * *

The ID of the trigger execution. */ public TriggerExecution withId(@Nonnull String id) { @@ -243,7 +234,6 @@ public TriggerExecution withId(@Nonnull String id) { return this; } - /** * Output only. The ID of the interaction created by this execution, if any. */ @@ -252,7 +242,6 @@ public TriggerExecution withInteractionId(@Nullable String interactionId) { return this; } - /** * Output only. The time when the execution was scheduled to run. */ @@ -261,7 +250,6 @@ public TriggerExecution withScheduledTime(@Nullable OffsetDateTime scheduledTime return this; } - /** * Output only. The time when the execution started. */ @@ -270,7 +258,6 @@ public TriggerExecution withStartTime(@Nullable OffsetDateTime startTime) { return this; } - /** * Output only. The status of the execution. */ @@ -279,10 +266,9 @@ public TriggerExecution withStatus(@Nullable TriggerExecutionStatus status) { return this; } - /** * Required. Output only. Identifier. - * + * *

The ID of the trigger that created this execution. */ public TriggerExecution withTriggerId(@Nonnull String triggerId) { @@ -290,7 +276,6 @@ public TriggerExecution withTriggerId(@Nonnull String triggerId) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -300,42 +285,49 @@ public boolean equals(java.lang.Object o) { return false; } TriggerExecution other = (TriggerExecution) o; - return - Utils.enhancedDeepEquals(this.endTime, other.endTime) && - Utils.enhancedDeepEquals(this.environmentId, other.environmentId) && - Utils.enhancedDeepEquals(this.error, other.error) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.interactionId, other.interactionId) && - Utils.enhancedDeepEquals(this.scheduledTime, other.scheduledTime) && - Utils.enhancedDeepEquals(this.startTime, other.startTime) && - Utils.enhancedDeepEquals(this.status, other.status) && - Utils.enhancedDeepEquals(this.triggerId, other.triggerId); + return Utils.enhancedDeepEquals(this.endTime, other.endTime) + && Utils.enhancedDeepEquals(this.environmentId, other.environmentId) + && Utils.enhancedDeepEquals(this.error, other.error) + && Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.interactionId, other.interactionId) + && Utils.enhancedDeepEquals(this.scheduledTime, other.scheduledTime) + && Utils.enhancedDeepEquals(this.startTime, other.startTime) + && Utils.enhancedDeepEquals(this.status, other.status) + && Utils.enhancedDeepEquals(this.triggerId, other.triggerId); } - + @Override public int hashCode() { return Utils.enhancedHash( - endTime, environmentId, error, - id, interactionId, scheduledTime, - startTime, status, triggerId); + endTime, environmentId, error, id, interactionId, scheduledTime, startTime, status, triggerId); } - + @Override public String toString() { - return Utils.toString(TriggerExecution.class, - "endTime", endTime, - "environmentId", environmentId, - "error", error, - "id", id, - "interactionId", interactionId, - "scheduledTime", scheduledTime, - "startTime", startTime, - "status", status, - "triggerId", triggerId); + return Utils.toString( + TriggerExecution.class, + "endTime", + endTime, + "environmentId", + environmentId, + "error", + error, + "id", + id, + "interactionId", + interactionId, + "scheduledTime", + scheduledTime, + "startTime", + startTime, + "status", + status, + "triggerId", + triggerId); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private OffsetDateTime endTime; @@ -356,7 +348,7 @@ public final static class Builder { private String triggerId; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -385,7 +377,7 @@ public Builder error(@Nullable String error) { /** * Required. Output only. Identifier. - * + * *

The ID of the trigger execution. */ public Builder id(@Nonnull String id) { @@ -427,7 +419,7 @@ public Builder status(@Nullable TriggerExecutionStatus status) { /** * Required. Output only. Identifier. - * + * *

The ID of the trigger that created this execution. */ public Builder triggerId(@Nonnull String triggerId) { @@ -437,10 +429,7 @@ public Builder triggerId(@Nonnull String triggerId) { public TriggerExecution build() { return new TriggerExecution( - endTime, environmentId, error, - id, interactionId, scheduledTime, - startTime, status, triggerId); + endTime, environmentId, error, id, interactionId, scheduledTime, startTime, status, triggerId); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/triggers/TriggerExecutionStatus.java b/src/main/java/com/google/genai/gaos/models/triggers/TriggerExecutionStatus.java index 0e30f845b73..7a0d6a892a6 100644 --- a/src/main/java/com/google/genai/gaos/models/triggers/TriggerExecutionStatus.java +++ b/src/main/java/com/google/genai/gaos/models/triggers/TriggerExecutionStatus.java @@ -36,7 +36,7 @@ */ /** * TriggerExecutionStatus - * + * *

Output only. The status of the execution. */ public class TriggerExecutionStatus { @@ -62,12 +62,12 @@ private TriggerExecutionStatus(String value) { } /** - * Returns a TriggerExecutionStatus with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a TriggerExecutionStatus with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as TriggerExecutionStatus - */ + */ @JsonCreator public static TriggerExecutionStatus of(String value) { synchronized (TriggerExecutionStatus.class) { @@ -95,12 +95,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; TriggerExecutionStatus other = (TriggerExecutionStatus) obj; return Objects.equals(value, other.value); } @@ -136,15 +133,15 @@ private static final Map createEnumsMap() { map.put("timed_out", TriggerExecutionStatusEnum.TIMED_OUT); return map; } - - + public enum TriggerExecutionStatusEnum { IN_PROGRESS("in_progress"), COMPLETED("completed"), FAILED("failed"), SKIPPED("skipped"), - TIMED_OUT("timed_out"),; + TIMED_OUT("timed_out"), + ; private final String value; @@ -157,4 +154,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/triggers/TriggerStatus.java b/src/main/java/com/google/genai/gaos/models/triggers/TriggerStatus.java index d3efd9172e3..34cf4c5c922 100644 --- a/src/main/java/com/google/genai/gaos/models/triggers/TriggerStatus.java +++ b/src/main/java/com/google/genai/gaos/models/triggers/TriggerStatus.java @@ -36,7 +36,7 @@ */ /** * TriggerStatus - * + * *

Output only. The current status of the trigger. */ public class TriggerStatus { @@ -60,12 +60,12 @@ private TriggerStatus(String value) { } /** - * Returns a TriggerStatus with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a TriggerStatus with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as TriggerStatus - */ + */ @JsonCreator public static TriggerStatus of(String value) { synchronized (TriggerStatus.class) { @@ -93,12 +93,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; TriggerStatus other = (TriggerStatus) obj; return Objects.equals(value, other.value); } @@ -130,13 +127,13 @@ private static final Map createEnumsMap() { map.put("error", TriggerStatusEnum.ERROR); return map; } - - + public enum TriggerStatusEnum { ACTIVE("active"), PAUSED("paused"), - ERROR("error"),; + ERROR("error"), + ; private final String value; @@ -149,4 +146,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/triggers/TriggerUpdate.java b/src/main/java/com/google/genai/gaos/models/triggers/TriggerUpdate.java index 6366dda51fe..688f9aae9ba 100644 --- a/src/main/java/com/google/genai/gaos/models/triggers/TriggerUpdate.java +++ b/src/main/java/com/google/genai/gaos/models/triggers/TriggerUpdate.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.triggers; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -31,7 +31,7 @@ /** * TriggerUpdate - * + * *

Represents the fields of a Trigger that can be updated. */ public class TriggerUpdate { @@ -56,7 +56,7 @@ public TriggerUpdate( this.displayName = displayName; this.status = status; } - + public TriggerUpdate() { this(null, null); } @@ -79,7 +79,6 @@ public static Builder builder() { return new Builder(); } - /** * Optional. The display name of the trigger. */ @@ -88,7 +87,6 @@ public TriggerUpdate withDisplayName(@Nullable String displayName) { return this; } - /** * Optional. The status of the trigger. */ @@ -97,7 +95,6 @@ public TriggerUpdate withStatus(@Nullable TriggerUpdateStatus status) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -107,33 +104,29 @@ public boolean equals(java.lang.Object o) { return false; } TriggerUpdate other = (TriggerUpdate) o; - return - Utils.enhancedDeepEquals(this.displayName, other.displayName) && - Utils.enhancedDeepEquals(this.status, other.status); + return Utils.enhancedDeepEquals(this.displayName, other.displayName) + && Utils.enhancedDeepEquals(this.status, other.status); } - + @Override public int hashCode() { - return Utils.enhancedHash( - displayName, status); + return Utils.enhancedHash(displayName, status); } - + @Override public String toString() { - return Utils.toString(TriggerUpdate.class, - "displayName", displayName, - "status", status); + return Utils.toString(TriggerUpdate.class, "displayName", displayName, "status", status); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String displayName; private TriggerUpdateStatus status; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -153,9 +146,7 @@ public Builder status(@Nullable TriggerUpdateStatus status) { } public TriggerUpdate build() { - return new TriggerUpdate( - displayName, status); + return new TriggerUpdate(displayName, status); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/triggers/TriggerUpdateStatus.java b/src/main/java/com/google/genai/gaos/models/triggers/TriggerUpdateStatus.java index b7a8d60718d..59af0b9aeab 100644 --- a/src/main/java/com/google/genai/gaos/models/triggers/TriggerUpdateStatus.java +++ b/src/main/java/com/google/genai/gaos/models/triggers/TriggerUpdateStatus.java @@ -26,7 +26,7 @@ /** * TriggerUpdateStatus - * + * *

Optional. The status of the trigger. */ public enum TriggerUpdateStatus { @@ -40,13 +40,13 @@ public enum TriggerUpdateStatus { TriggerUpdateStatus(String value) { this.value = value; } - + public String value() { return value; } - + public static Optional fromValue(String value) { - for (TriggerUpdateStatus o: TriggerUpdateStatus.values()) { + for (TriggerUpdateStatus o : TriggerUpdateStatus.values()) { if (Objects.deepEquals(o.value, value)) { return Optional.of(o); } @@ -54,4 +54,3 @@ public static Optional fromValue(String value) { return Optional.empty(); } } - diff --git a/src/main/java/com/google/genai/gaos/models/webhooks/PingWebhookRequest.java b/src/main/java/com/google/genai/gaos/models/webhooks/PingWebhookRequest.java index 3329bae1649..b1be00fefad 100644 --- a/src/main/java/com/google/genai/gaos/models/webhooks/PingWebhookRequest.java +++ b/src/main/java/com/google/genai/gaos/models/webhooks/PingWebhookRequest.java @@ -26,19 +26,17 @@ /** * PingWebhookRequest - * + * *

Request message for WebhookService.PingWebhook. */ public class PingWebhookRequest { @JsonCreator - public PingWebhookRequest() { - } + public PingWebhookRequest() {} public static Builder builder() { return new Builder(); } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -49,29 +47,26 @@ public boolean equals(java.lang.Object o) { } return true; } - + @Override public int hashCode() { - return Utils.enhancedHash( - ); + return Utils.enhancedHash(); } - + @Override public String toString() { return Utils.toString(PingWebhookRequest.class); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Builder() { - // force use of static builder() method + // force use of static builder() method } public PingWebhookRequest build() { - return new PingWebhookRequest( - ); + return new PingWebhookRequest(); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/webhooks/RevocationBehavior.java b/src/main/java/com/google/genai/gaos/models/webhooks/RevocationBehavior.java index 91257b42ec2..796c9944f1b 100644 --- a/src/main/java/com/google/genai/gaos/models/webhooks/RevocationBehavior.java +++ b/src/main/java/com/google/genai/gaos/models/webhooks/RevocationBehavior.java @@ -26,7 +26,7 @@ /** * RevocationBehavior - * + * *

Optional. The revocation behavior for previous signing secrets. */ public enum RevocationBehavior { @@ -39,13 +39,13 @@ public enum RevocationBehavior { RevocationBehavior(String value) { this.value = value; } - + public String value() { return value; } - + public static Optional fromValue(String value) { - for (RevocationBehavior o: RevocationBehavior.values()) { + for (RevocationBehavior o : RevocationBehavior.values()) { if (Objects.deepEquals(o.value, value)) { return Optional.of(o); } @@ -53,4 +53,3 @@ public static Optional fromValue(String value) { return Optional.empty(); } } - diff --git a/src/main/java/com/google/genai/gaos/models/webhooks/RotateSigningSecretRequest.java b/src/main/java/com/google/genai/gaos/models/webhooks/RotateSigningSecretRequest.java index 95a898da83f..47cf09ea0c4 100644 --- a/src/main/java/com/google/genai/gaos/models/webhooks/RotateSigningSecretRequest.java +++ b/src/main/java/com/google/genai/gaos/models/webhooks/RotateSigningSecretRequest.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.webhooks; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -31,7 +31,7 @@ /** * RotateSigningSecretRequest - * + * *

Request message for WebhookService.RotateSigningSecret. */ public class RotateSigningSecretRequest { @@ -47,7 +47,7 @@ public RotateSigningSecretRequest( @JsonProperty("revocation_behavior") @Nullable RevocationBehavior revocationBehavior) { this.revocationBehavior = revocationBehavior; } - + public RotateSigningSecretRequest() { this(null); } @@ -63,7 +63,6 @@ public static Builder builder() { return new Builder(); } - /** * Optional. The revocation behavior for previous signing secrets. */ @@ -72,7 +71,6 @@ public RotateSigningSecretRequest withRevocationBehavior(@Nullable RevocationBeh return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -82,29 +80,26 @@ public boolean equals(java.lang.Object o) { return false; } RotateSigningSecretRequest other = (RotateSigningSecretRequest) o; - return - Utils.enhancedDeepEquals(this.revocationBehavior, other.revocationBehavior); + return Utils.enhancedDeepEquals(this.revocationBehavior, other.revocationBehavior); } - + @Override public int hashCode() { - return Utils.enhancedHash( - revocationBehavior); + return Utils.enhancedHash(revocationBehavior); } - + @Override public String toString() { - return Utils.toString(RotateSigningSecretRequest.class, - "revocationBehavior", revocationBehavior); + return Utils.toString(RotateSigningSecretRequest.class, "revocationBehavior", revocationBehavior); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private RevocationBehavior revocationBehavior; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -116,9 +111,7 @@ public Builder revocationBehavior(@Nullable RevocationBehavior revocationBehavio } public RotateSigningSecretRequest build() { - return new RotateSigningSecretRequest( - revocationBehavior); + return new RotateSigningSecretRequest(revocationBehavior); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/webhooks/SigningSecret.java b/src/main/java/com/google/genai/gaos/models/webhooks/SigningSecret.java index 6838baf4bf4..6a7c48ca6ac 100644 --- a/src/main/java/com/google/genai/gaos/models/webhooks/SigningSecret.java +++ b/src/main/java/com/google/genai/gaos/models/webhooks/SigningSecret.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.webhooks; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * SigningSecret - * + * *

Represents a signing secret used to verify webhook payloads. */ public class SigningSecret { @@ -57,7 +57,7 @@ public SigningSecret( this.expireTime = expireTime; this.truncatedSecret = truncatedSecret; } - + public SigningSecret() { this(null, null); } @@ -80,7 +80,6 @@ public static Builder builder() { return new Builder(); } - /** * Output only. The expiration date of the signing secret. */ @@ -89,7 +88,6 @@ public SigningSecret withExpireTime(@Nullable OffsetDateTime expireTime) { return this; } - /** * Output only. The truncated version of the signing secret. */ @@ -98,7 +96,6 @@ public SigningSecret withTruncatedSecret(@Nullable String truncatedSecret) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -108,33 +105,29 @@ public boolean equals(java.lang.Object o) { return false; } SigningSecret other = (SigningSecret) o; - return - Utils.enhancedDeepEquals(this.expireTime, other.expireTime) && - Utils.enhancedDeepEquals(this.truncatedSecret, other.truncatedSecret); + return Utils.enhancedDeepEquals(this.expireTime, other.expireTime) + && Utils.enhancedDeepEquals(this.truncatedSecret, other.truncatedSecret); } - + @Override public int hashCode() { - return Utils.enhancedHash( - expireTime, truncatedSecret); + return Utils.enhancedHash(expireTime, truncatedSecret); } - + @Override public String toString() { - return Utils.toString(SigningSecret.class, - "expireTime", expireTime, - "truncatedSecret", truncatedSecret); + return Utils.toString(SigningSecret.class, "expireTime", expireTime, "truncatedSecret", truncatedSecret); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private OffsetDateTime expireTime; private String truncatedSecret; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -154,9 +147,7 @@ public Builder truncatedSecret(@Nullable String truncatedSecret) { } public SigningSecret build() { - return new SigningSecret( - expireTime, truncatedSecret); + return new SigningSecret(expireTime, truncatedSecret); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/webhooks/Webhook.java b/src/main/java/com/google/genai/gaos/models/webhooks/Webhook.java index ea680f411d8..aec6f51ed15 100644 --- a/src/main/java/com/google/genai/gaos/models/webhooks/Webhook.java +++ b/src/main/java/com/google/genai/gaos/models/webhooks/Webhook.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.webhooks; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nonnull; @@ -34,7 +34,7 @@ /** * Webhook - * + * *

A Webhook resource. */ public class Webhook { @@ -125,18 +125,13 @@ public Webhook( this.signingSecrets = signingSecrets; this.state = state; this.subscribedEvents = Optional.ofNullable(subscribedEvents) - .orElseThrow(() -> new IllegalArgumentException("subscribedEvents cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("subscribedEvents cannot be null")); this.updateTime = updateTime; - this.uri = Optional.ofNullable(uri) - .orElseThrow(() -> new IllegalArgumentException("uri cannot be null")); + this.uri = Optional.ofNullable(uri).orElseThrow(() -> new IllegalArgumentException("uri cannot be null")); } - - public Webhook( - @Nonnull List subscribedEvents, - @Nonnull String uri) { - this(null, null, null, - null, null, null, - subscribedEvents, null, uri); + + public Webhook(@Nonnull List subscribedEvents, @Nonnull String uri) { + this(null, null, null, null, null, null, subscribedEvents, null, uri); } /** @@ -214,7 +209,6 @@ public static Builder builder() { return new Builder(); } - /** * Output only. The timestamp when the webhook was created. */ @@ -223,7 +217,6 @@ public Webhook withCreateTime(@Nullable OffsetDateTime createTime) { return this; } - /** * Output only. The ID of the webhook. */ @@ -232,7 +225,6 @@ public Webhook withId(@Nullable String id) { return this; } - /** * Optional. The user-provided name of the webhook. */ @@ -241,7 +233,6 @@ public Webhook withName(@Nullable String name) { return this; } - /** * Output only. The new signing secret for the webhook. Only populated on create. */ @@ -250,7 +241,6 @@ public Webhook withNewSigningSecret(@Nullable String newSigningSecret) { return this; } - /** * Output only. The signing secrets associated with this webhook. */ @@ -259,7 +249,6 @@ public Webhook withSigningSecrets(@Nullable List signingSecrets) return this; } - /** * Output only. The state of the webhook. */ @@ -268,7 +257,6 @@ public Webhook withState(@Nullable WebhookState state) { return this; } - /** * Required. The events that the webhook is subscribed to. * Available events: @@ -285,7 +273,6 @@ public Webhook withSubscribedEvents(@Nonnull List subscr return this; } - /** * Output only. The timestamp when the webhook was last updated. */ @@ -294,7 +281,6 @@ public Webhook withUpdateTime(@Nullable OffsetDateTime updateTime) { return this; } - /** * Required. The URI to which webhook events will be sent. */ @@ -303,7 +289,6 @@ public Webhook withUri(@Nonnull String uri) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -313,42 +298,49 @@ public boolean equals(java.lang.Object o) { return false; } Webhook other = (Webhook) o; - return - Utils.enhancedDeepEquals(this.createTime, other.createTime) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.name, other.name) && - Utils.enhancedDeepEquals(this.newSigningSecret, other.newSigningSecret) && - Utils.enhancedDeepEquals(this.signingSecrets, other.signingSecrets) && - Utils.enhancedDeepEquals(this.state, other.state) && - Utils.enhancedDeepEquals(this.subscribedEvents, other.subscribedEvents) && - Utils.enhancedDeepEquals(this.updateTime, other.updateTime) && - Utils.enhancedDeepEquals(this.uri, other.uri); + return Utils.enhancedDeepEquals(this.createTime, other.createTime) + && Utils.enhancedDeepEquals(this.id, other.id) + && Utils.enhancedDeepEquals(this.name, other.name) + && Utils.enhancedDeepEquals(this.newSigningSecret, other.newSigningSecret) + && Utils.enhancedDeepEquals(this.signingSecrets, other.signingSecrets) + && Utils.enhancedDeepEquals(this.state, other.state) + && Utils.enhancedDeepEquals(this.subscribedEvents, other.subscribedEvents) + && Utils.enhancedDeepEquals(this.updateTime, other.updateTime) + && Utils.enhancedDeepEquals(this.uri, other.uri); } - + @Override public int hashCode() { return Utils.enhancedHash( - createTime, id, name, - newSigningSecret, signingSecrets, state, - subscribedEvents, updateTime, uri); + createTime, id, name, newSigningSecret, signingSecrets, state, subscribedEvents, updateTime, uri); } - + @Override public String toString() { - return Utils.toString(Webhook.class, - "createTime", createTime, - "id", id, - "name", name, - "newSigningSecret", newSigningSecret, - "signingSecrets", signingSecrets, - "state", state, - "subscribedEvents", subscribedEvents, - "updateTime", updateTime, - "uri", uri); + return Utils.toString( + Webhook.class, + "createTime", + createTime, + "id", + id, + "name", + name, + "newSigningSecret", + newSigningSecret, + "signingSecrets", + signingSecrets, + "state", + state, + "subscribedEvents", + subscribedEvents, + "updateTime", + updateTime, + "uri", + uri); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private OffsetDateTime createTime; @@ -369,7 +361,7 @@ public final static class Builder { private String uri; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -454,10 +446,7 @@ public Builder uri(@Nonnull String uri) { public Webhook build() { return new Webhook( - createTime, id, name, - newSigningSecret, signingSecrets, state, - subscribedEvents, updateTime, uri); + createTime, id, name, newSigningSecret, signingSecrets, state, subscribedEvents, updateTime, uri); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/webhooks/WebhookInput.java b/src/main/java/com/google/genai/gaos/models/webhooks/WebhookInput.java index 58cf69deaa3..a1281766acd 100644 --- a/src/main/java/com/google/genai/gaos/models/webhooks/WebhookInput.java +++ b/src/main/java/com/google/genai/gaos/models/webhooks/WebhookInput.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.webhooks; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nonnull; @@ -33,7 +33,7 @@ /** * WebhookInput - * + * *

A Webhook resource. */ public class WebhookInput { @@ -71,14 +71,11 @@ public WebhookInput( @JsonProperty("uri") @Nonnull String uri) { this.name = name; this.subscribedEvents = Optional.ofNullable(subscribedEvents) - .orElseThrow(() -> new IllegalArgumentException("subscribedEvents cannot be null")); - this.uri = Optional.ofNullable(uri) - .orElseThrow(() -> new IllegalArgumentException("uri cannot be null")); + .orElseThrow(() -> new IllegalArgumentException("subscribedEvents cannot be null")); + this.uri = Optional.ofNullable(uri).orElseThrow(() -> new IllegalArgumentException("uri cannot be null")); } - - public WebhookInput( - @Nonnull List subscribedEvents, - @Nonnull String uri) { + + public WebhookInput(@Nonnull List subscribedEvents, @Nonnull String uri) { this(null, subscribedEvents, uri); } @@ -115,7 +112,6 @@ public static Builder builder() { return new Builder(); } - /** * Optional. The user-provided name of the webhook. */ @@ -124,7 +120,6 @@ public WebhookInput withName(@Nullable String name) { return this; } - /** * Required. The events that the webhook is subscribed to. * Available events: @@ -141,7 +136,6 @@ public WebhookInput withSubscribedEvents(@Nonnull List s return this; } - /** * Required. The URI to which webhook events will be sent. */ @@ -150,7 +144,6 @@ public WebhookInput withUri(@Nonnull String uri) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -160,28 +153,23 @@ public boolean equals(java.lang.Object o) { return false; } WebhookInput other = (WebhookInput) o; - return - Utils.enhancedDeepEquals(this.name, other.name) && - Utils.enhancedDeepEquals(this.subscribedEvents, other.subscribedEvents) && - Utils.enhancedDeepEquals(this.uri, other.uri); + return Utils.enhancedDeepEquals(this.name, other.name) + && Utils.enhancedDeepEquals(this.subscribedEvents, other.subscribedEvents) + && Utils.enhancedDeepEquals(this.uri, other.uri); } - + @Override public int hashCode() { - return Utils.enhancedHash( - name, subscribedEvents, uri); + return Utils.enhancedHash(name, subscribedEvents, uri); } - + @Override public String toString() { - return Utils.toString(WebhookInput.class, - "name", name, - "subscribedEvents", subscribedEvents, - "uri", uri); + return Utils.toString(WebhookInput.class, "name", name, "subscribedEvents", subscribedEvents, "uri", uri); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String name; @@ -190,7 +178,7 @@ public final static class Builder { private String uri; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -226,9 +214,7 @@ public Builder uri(@Nonnull String uri) { } public WebhookInput build() { - return new WebhookInput( - name, subscribedEvents, uri); + return new WebhookInput(name, subscribedEvents, uri); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/webhooks/WebhookListResponse.java b/src/main/java/com/google/genai/gaos/models/webhooks/WebhookListResponse.java index c114272908e..8f53032d9fa 100644 --- a/src/main/java/com/google/genai/gaos/models/webhooks/WebhookListResponse.java +++ b/src/main/java/com/google/genai/gaos/models/webhooks/WebhookListResponse.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.webhooks; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -32,7 +32,7 @@ /** * WebhookListResponse - * + * *

Response message for WebhookService.ListWebhooks. */ public class WebhookListResponse { @@ -58,7 +58,7 @@ public WebhookListResponse( this.nextPageToken = nextPageToken; this.webhooks = webhooks; } - + public WebhookListResponse() { this(null, null); } @@ -82,7 +82,6 @@ public static Builder builder() { return new Builder(); } - /** * A token, which can be sent as `page_token` to retrieve the next page. * If this field is omitted, there are no subsequent pages. @@ -92,7 +91,6 @@ public WebhookListResponse withNextPageToken(@Nullable String nextPageToken) { return this; } - /** * The webhooks. */ @@ -101,7 +99,6 @@ public WebhookListResponse withWebhooks(@Nullable List webhooks) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -111,33 +108,29 @@ public boolean equals(java.lang.Object o) { return false; } WebhookListResponse other = (WebhookListResponse) o; - return - Utils.enhancedDeepEquals(this.nextPageToken, other.nextPageToken) && - Utils.enhancedDeepEquals(this.webhooks, other.webhooks); + return Utils.enhancedDeepEquals(this.nextPageToken, other.nextPageToken) + && Utils.enhancedDeepEquals(this.webhooks, other.webhooks); } - + @Override public int hashCode() { - return Utils.enhancedHash( - nextPageToken, webhooks); + return Utils.enhancedHash(nextPageToken, webhooks); } - + @Override public String toString() { - return Utils.toString(WebhookListResponse.class, - "nextPageToken", nextPageToken, - "webhooks", webhooks); + return Utils.toString(WebhookListResponse.class, "nextPageToken", nextPageToken, "webhooks", webhooks); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String nextPageToken; private List webhooks; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -158,9 +151,7 @@ public Builder webhooks(@Nullable List webhooks) { } public WebhookListResponse build() { - return new WebhookListResponse( - nextPageToken, webhooks); + return new WebhookListResponse(nextPageToken, webhooks); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/webhooks/WebhookPingResponse.java b/src/main/java/com/google/genai/gaos/models/webhooks/WebhookPingResponse.java index 09eeda0533f..09eb128767a 100644 --- a/src/main/java/com/google/genai/gaos/models/webhooks/WebhookPingResponse.java +++ b/src/main/java/com/google/genai/gaos/models/webhooks/WebhookPingResponse.java @@ -26,19 +26,17 @@ /** * WebhookPingResponse - * + * *

Response message for WebhookService.PingWebhook. */ public class WebhookPingResponse { @JsonCreator - public WebhookPingResponse() { - } + public WebhookPingResponse() {} public static Builder builder() { return new Builder(); } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -49,29 +47,26 @@ public boolean equals(java.lang.Object o) { } return true; } - + @Override public int hashCode() { - return Utils.enhancedHash( - ); + return Utils.enhancedHash(); } - + @Override public String toString() { return Utils.toString(WebhookPingResponse.class); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private Builder() { - // force use of static builder() method + // force use of static builder() method } public WebhookPingResponse build() { - return new WebhookPingResponse( - ); + return new WebhookPingResponse(); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/webhooks/WebhookRotateSigningSecretResponse.java b/src/main/java/com/google/genai/gaos/models/webhooks/WebhookRotateSigningSecretResponse.java index df30023470f..777d26b86ff 100644 --- a/src/main/java/com/google/genai/gaos/models/webhooks/WebhookRotateSigningSecretResponse.java +++ b/src/main/java/com/google/genai/gaos/models/webhooks/WebhookRotateSigningSecretResponse.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.webhooks; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -31,7 +31,7 @@ /** * WebhookRotateSigningSecretResponse - * + * *

Response message for WebhookService.RotateSigningSecret. */ public class WebhookRotateSigningSecretResponse { @@ -43,11 +43,10 @@ public class WebhookRotateSigningSecretResponse { private String secret; @JsonCreator - public WebhookRotateSigningSecretResponse( - @JsonProperty("secret") @Nullable String secret) { + public WebhookRotateSigningSecretResponse(@JsonProperty("secret") @Nullable String secret) { this.secret = secret; } - + public WebhookRotateSigningSecretResponse() { this(null); } @@ -63,7 +62,6 @@ public static Builder builder() { return new Builder(); } - /** * Output only. The newly generated signing secret. */ @@ -72,7 +70,6 @@ public WebhookRotateSigningSecretResponse withSecret(@Nullable String secret) { return this; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -82,29 +79,26 @@ public boolean equals(java.lang.Object o) { return false; } WebhookRotateSigningSecretResponse other = (WebhookRotateSigningSecretResponse) o; - return - Utils.enhancedDeepEquals(this.secret, other.secret); + return Utils.enhancedDeepEquals(this.secret, other.secret); } - + @Override public int hashCode() { - return Utils.enhancedHash( - secret); + return Utils.enhancedHash(secret); } - + @Override public String toString() { - return Utils.toString(WebhookRotateSigningSecretResponse.class, - "secret", secret); + return Utils.toString(WebhookRotateSigningSecretResponse.class, "secret", secret); } @SuppressWarnings("UnusedReturnValue") - public final static class Builder { + public static final class Builder { private String secret; private Builder() { - // force use of static builder() method + // force use of static builder() method } /** @@ -116,9 +110,7 @@ public Builder secret(@Nullable String secret) { } public WebhookRotateSigningSecretResponse build() { - return new WebhookRotateSigningSecretResponse( - secret); + return new WebhookRotateSigningSecretResponse(secret); } - } } diff --git a/src/main/java/com/google/genai/gaos/models/webhooks/WebhookState.java b/src/main/java/com/google/genai/gaos/models/webhooks/WebhookState.java index 1dc830ab808..ea54a380812 100644 --- a/src/main/java/com/google/genai/gaos/models/webhooks/WebhookState.java +++ b/src/main/java/com/google/genai/gaos/models/webhooks/WebhookState.java @@ -36,14 +36,15 @@ */ /** * WebhookState - * + * *

Output only. The state of the webhook. */ public class WebhookState { public static final WebhookState ENABLED = new WebhookState("enabled"); public static final WebhookState DISABLED = new WebhookState("disabled"); - public static final WebhookState DISABLED_DUE_TO_FAILED_DELIVERIES = new WebhookState("disabled_due_to_failed_deliveries"); + public static final WebhookState DISABLED_DUE_TO_FAILED_DELIVERIES = + new WebhookState("disabled_due_to_failed_deliveries"); // This map will grow whenever a Color gets created with a new // unrecognized value (a potential memory leak if the user is not @@ -60,12 +61,12 @@ private WebhookState(String value) { } /** - * Returns a WebhookState with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a WebhookState with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as WebhookState - */ + */ @JsonCreator public static WebhookState of(String value) { synchronized (WebhookState.class) { @@ -93,12 +94,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; WebhookState other = (WebhookState) obj; return Objects.equals(value, other.value); } @@ -130,13 +128,13 @@ private static final Map createEnumsMap() { map.put("disabled_due_to_failed_deliveries", WebhookStateEnum.DISABLED_DUE_TO_FAILED_DELIVERIES); return map; } - - + public enum WebhookStateEnum { ENABLED("enabled"), DISABLED("disabled"), - DISABLED_DUE_TO_FAILED_DELIVERIES("disabled_due_to_failed_deliveries"),; + DISABLED_DUE_TO_FAILED_DELIVERIES("disabled_due_to_failed_deliveries"), + ; private final String value; @@ -149,4 +147,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/webhooks/WebhookSubscribedEvent.java b/src/main/java/com/google/genai/gaos/models/webhooks/WebhookSubscribedEvent.java index 888bd8f0294..05d53e77ca3 100644 --- a/src/main/java/com/google/genai/gaos/models/webhooks/WebhookSubscribedEvent.java +++ b/src/main/java/com/google/genai/gaos/models/webhooks/WebhookSubscribedEvent.java @@ -39,8 +39,10 @@ public class WebhookSubscribedEvent { public static final WebhookSubscribedEvent BATCH_SUCCEEDED = new WebhookSubscribedEvent("batch.succeeded"); public static final WebhookSubscribedEvent BATCH_EXPIRED = new WebhookSubscribedEvent("batch.expired"); public static final WebhookSubscribedEvent BATCH_FAILED = new WebhookSubscribedEvent("batch.failed"); - public static final WebhookSubscribedEvent INTERACTION_REQUIRES_ACTION = new WebhookSubscribedEvent("interaction.requires_action"); - public static final WebhookSubscribedEvent INTERACTION_COMPLETED = new WebhookSubscribedEvent("interaction.completed"); + public static final WebhookSubscribedEvent INTERACTION_REQUIRES_ACTION = + new WebhookSubscribedEvent("interaction.requires_action"); + public static final WebhookSubscribedEvent INTERACTION_COMPLETED = + new WebhookSubscribedEvent("interaction.completed"); public static final WebhookSubscribedEvent INTERACTION_FAILED = new WebhookSubscribedEvent("interaction.failed"); public static final WebhookSubscribedEvent VIDEO_GENERATED = new WebhookSubscribedEvent("video.generated"); @@ -59,12 +61,12 @@ private WebhookSubscribedEvent(String value) { } /** - * Returns a WebhookSubscribedEvent with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a WebhookSubscribedEvent with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as WebhookSubscribedEvent - */ + */ @JsonCreator public static WebhookSubscribedEvent of(String value) { synchronized (WebhookSubscribedEvent.class) { @@ -92,12 +94,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; WebhookSubscribedEvent other = (WebhookSubscribedEvent) obj; return Objects.equals(value, other.value); } @@ -137,8 +136,7 @@ private static final Map createEnumsMap() { map.put("video.generated", WebhookSubscribedEventEnum.VIDEO_GENERATED); return map; } - - + public enum WebhookSubscribedEventEnum { BATCH_SUCCEEDED("batch.succeeded"), @@ -147,7 +145,8 @@ public enum WebhookSubscribedEventEnum { INTERACTION_REQUIRES_ACTION("interaction.requires_action"), INTERACTION_COMPLETED("interaction.completed"), INTERACTION_FAILED("interaction.failed"), - VIDEO_GENERATED("video.generated"),; + VIDEO_GENERATED("video.generated"), + ; private final String value; @@ -160,4 +159,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/models/webhooks/WebhookUpdate.java b/src/main/java/com/google/genai/gaos/models/webhooks/WebhookUpdate.java index 7b165c279bf..5ac4d5729f6 100644 --- a/src/main/java/com/google/genai/gaos/models/webhooks/WebhookUpdate.java +++ b/src/main/java/com/google/genai/gaos/models/webhooks/WebhookUpdate.java @@ -20,8 +20,8 @@ package com.google.genai.gaos.models.webhooks; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.genai.gaos.utils.Utils; import jakarta.annotation.Nullable; @@ -30,7 +30,6 @@ import java.util.List; import java.util.Optional; - public class WebhookUpdate { /** * Optional. The user-provided name of the webhook. @@ -79,10 +78,9 @@ public WebhookUpdate( this.subscribedEvents = subscribedEvents; this.uri = uri; } - + public WebhookUpdate() { - this(null, null, null, - null); + this(null, null, null, null); } /** @@ -125,7 +123,6 @@ public static Builder builder() { return new Builder(); } - /** * Optional. The user-provided name of the webhook. */ @@ -134,7 +131,6 @@ public WebhookUpdate withName(@Nullable String name) { return this; } - /** * Optional. The state of the webhook. */ @@ -143,7 +139,6 @@ public WebhookUpdate withState(@Nullable WebhookUpdateState state) { return this; } - /** * Optional. The events that the webhook is subscribed to. * Available events: @@ -160,7 +155,6 @@ public WebhookUpdate withSubscribedEvents(@Nullable ListOptional. The state of the webhook. */ public enum WebhookUpdateState { @@ -40,13 +40,13 @@ public enum WebhookUpdateState { WebhookUpdateState(String value) { this.value = value; } - + public String value() { return value; } - + public static Optional fromValue(String value) { - for (WebhookUpdateState o: WebhookUpdateState.values()) { + for (WebhookUpdateState o : WebhookUpdateState.values()) { if (Objects.deepEquals(o.value, value)) { return Optional.of(o); } @@ -54,4 +54,3 @@ public static Optional fromValue(String value) { return Optional.empty(); } } - diff --git a/src/main/java/com/google/genai/gaos/models/webhooks/WebhookUpdateSubscribedEvent.java b/src/main/java/com/google/genai/gaos/models/webhooks/WebhookUpdateSubscribedEvent.java index 3e0f11a94c7..6c3333619a4 100644 --- a/src/main/java/com/google/genai/gaos/models/webhooks/WebhookUpdateSubscribedEvent.java +++ b/src/main/java/com/google/genai/gaos/models/webhooks/WebhookUpdateSubscribedEvent.java @@ -36,13 +36,18 @@ */ public class WebhookUpdateSubscribedEvent { - public static final WebhookUpdateSubscribedEvent BATCH_SUCCEEDED = new WebhookUpdateSubscribedEvent("batch.succeeded"); + public static final WebhookUpdateSubscribedEvent BATCH_SUCCEEDED = + new WebhookUpdateSubscribedEvent("batch.succeeded"); public static final WebhookUpdateSubscribedEvent BATCH_EXPIRED = new WebhookUpdateSubscribedEvent("batch.expired"); public static final WebhookUpdateSubscribedEvent BATCH_FAILED = new WebhookUpdateSubscribedEvent("batch.failed"); - public static final WebhookUpdateSubscribedEvent INTERACTION_REQUIRES_ACTION = new WebhookUpdateSubscribedEvent("interaction.requires_action"); - public static final WebhookUpdateSubscribedEvent INTERACTION_COMPLETED = new WebhookUpdateSubscribedEvent("interaction.completed"); - public static final WebhookUpdateSubscribedEvent INTERACTION_FAILED = new WebhookUpdateSubscribedEvent("interaction.failed"); - public static final WebhookUpdateSubscribedEvent VIDEO_GENERATED = new WebhookUpdateSubscribedEvent("video.generated"); + public static final WebhookUpdateSubscribedEvent INTERACTION_REQUIRES_ACTION = + new WebhookUpdateSubscribedEvent("interaction.requires_action"); + public static final WebhookUpdateSubscribedEvent INTERACTION_COMPLETED = + new WebhookUpdateSubscribedEvent("interaction.completed"); + public static final WebhookUpdateSubscribedEvent INTERACTION_FAILED = + new WebhookUpdateSubscribedEvent("interaction.failed"); + public static final WebhookUpdateSubscribedEvent VIDEO_GENERATED = + new WebhookUpdateSubscribedEvent("video.generated"); // This map will grow whenever a Color gets created with a new // unrecognized value (a potential memory leak if the user is not @@ -59,12 +64,12 @@ private WebhookUpdateSubscribedEvent(String value) { } /** - * Returns a WebhookUpdateSubscribedEvent with the given value. For a specific value the - * returned object will always be a singleton so reference equality + * Returns a WebhookUpdateSubscribedEvent with the given value. For a specific value the + * returned object will always be a singleton so reference equality * is satisfied when the values are the same. - * + * * @param value value to be wrapped as WebhookUpdateSubscribedEvent - */ + */ @JsonCreator public static WebhookUpdateSubscribedEvent of(String value) { synchronized (WebhookUpdateSubscribedEvent.class) { @@ -92,12 +97,9 @@ public int hashCode() { @Override public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; WebhookUpdateSubscribedEvent other = (WebhookUpdateSubscribedEvent) obj; return Objects.equals(value, other.value); } @@ -137,8 +139,7 @@ private static final Map createEnumsMa map.put("video.generated", WebhookUpdateSubscribedEventEnum.VIDEO_GENERATED); return map; } - - + public enum WebhookUpdateSubscribedEventEnum { BATCH_SUCCEEDED("batch.succeeded"), @@ -147,7 +148,8 @@ public enum WebhookUpdateSubscribedEventEnum { INTERACTION_REQUIRES_ACTION("interaction.requires_action"), INTERACTION_COMPLETED("interaction.completed"), INTERACTION_FAILED("interaction.failed"), - VIDEO_GENERATED("video.generated"),; + VIDEO_GENERATED("video.generated"), + ; private final String value; @@ -160,4 +162,3 @@ public String value() { } } } - diff --git a/src/main/java/com/google/genai/gaos/operations/CancelInteractionById.java b/src/main/java/com/google/genai/gaos/operations/CancelInteractionById.java index 10a03e85808..b36a5de03e8 100644 --- a/src/main/java/com/google/genai/gaos/operations/CancelInteractionById.java +++ b/src/main/java/com/google/genai/gaos/operations/CancelInteractionById.java @@ -19,16 +19,16 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; import com.google.genai.gaos.models.errors.CancelInteractionByIdClientError; import com.google.genai.gaos.models.errors.CancelInteractionByIdServerError; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.interactions.Interaction; import com.google.genai.gaos.models.operations.CancelInteractionByIdRequest; import com.google.genai.gaos.models.operations.CancelInteractionByIdResponse; @@ -62,10 +62,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class CancelInteractionById { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -75,30 +74,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -131,15 +130,12 @@ AfterErrorContextImpl createAfterErrorContext() { java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { + + HttpRequest buildRequest(T request, Class klass) throws Exception { String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/interactions/{id}/cancel", - request, this.operationGlobals); + klass, this.baseUrl, "/{api_version}/interactions/{id}/cancel", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "POST"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -149,12 +145,8 @@ HttpRequest buildRequest(T request, Class klass) throws Exception { public static class Sync extends Base implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(CancelInteractionByIdRequest request) throws Exception { @@ -162,11 +154,11 @@ private HttpRequest onBuildRequest(CancelInteractionByIdRequest request) throws return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -199,55 +191,53 @@ public HttpResponse doRequest(CancelInteractionByIdRequest request) return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public CancelInteractionByIdResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - CancelInteractionByIdResponse.Builder resBuilder = - CancelInteractionByIdResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + CancelInteractionByIdResponse.Builder resBuilder = CancelInteractionByIdResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); CancelInteractionByIdResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withInteraction(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { if (Utils.contentTypeMatches(contentType, "application/json")) { throw CancelInteractionByIdClientError.from(response); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { if (Utils.contentTypeMatches(contentType, "application/json")) { throw CancelInteractionByIdServerError.from(response); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base - implements AsyncRequestOperation { + implements AsyncRequestOperation< + CancelInteractionByIdRequest, + com.google.genai.gaos.models.operations.async.CancelInteractionByIdResponse> { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -263,7 +253,8 @@ private CompletableFuture onBuildRequest(CancelInteractionByIdReque return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -278,57 +269,56 @@ public CompletableFuture> doRequest(CancelInteractionB .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.CancelInteractionByIdResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.CancelInteractionByIdResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.CancelInteractionByIdResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.CancelInteractionByIdResponse - .builder() + com.google.genai.gaos.models.operations.async.CancelInteractionByIdResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.CancelInteractionByIdResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withInteraction(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { if (Utils.contentTypeMatches(contentType, "application/json")) { throw CancelInteractionByIdClientError.from(response); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { if (Utils.contentTypeMatches(contentType, "application/json")) { throw CancelInteractionByIdServerError.from(response); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/CreateAgent.java b/src/main/java/com/google/genai/gaos/operations/CreateAgent.java index fce75babad8..62e749da768 100644 --- a/src/main/java/com/google/genai/gaos/operations/CreateAgent.java +++ b/src/main/java/com/google/genai/gaos/operations/CreateAgent.java @@ -19,15 +19,15 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; import com.google.genai.gaos.models.agents.Agent; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.CreateAgentRequest; import com.google.genai.gaos.models.operations.CreateAgentResponse; import com.google.genai.gaos.utils.AsyncRetries; @@ -45,8 +45,8 @@ import com.google.genai.gaos.utils.Retries; import com.google.genai.gaos.utils.RetryConfig; import com.google.genai.gaos.utils.SerializedBody; -import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils; +import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.transport.HttpRequest; import com.google.genai.gaos.utils.transport.HttpResponse; import jakarta.annotation.Nonnull; @@ -64,10 +64,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class CreateAgent { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -77,30 +76,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -109,52 +108,30 @@ Optional securitySource() { BeforeRequestContextImpl createBeforeRequestContext() { return new BeforeRequestContextImpl( - this.sdkConfiguration, - this.baseUrl, - "CreateAgent", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "CreateAgent", java.util.Optional.empty(), securitySource()); } AfterSuccessContextImpl createAfterSuccessContext() { return new AfterSuccessContextImpl( - this.sdkConfiguration, - this.baseUrl, - "CreateAgent", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "CreateAgent", java.util.Optional.empty(), securitySource()); } AfterErrorContextImpl createAfterErrorContext() { return new AfterErrorContextImpl( - this.sdkConfiguration, - this.baseUrl, - "CreateAgent", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "CreateAgent", java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { - String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/agents", - request, this.operationGlobals); + + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + String url = + Utils.generateURL(klass, this.baseUrl, "/{api_version}/agents", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - typeReference); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "body", - "json", - false); + Object convertedRequest = Utils.convertToShape(request, JsonShape.DEFAULT, typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody(convertedRequest, "body", "json", false); if (serializedRequestBody == null) { throw new IllegalArgumentException("Request body is required"); } req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -162,26 +139,22 @@ HttpRequest buildRequest(T request, Class klass, TypeReference typeR } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(CreateAgentRequest request) throws Exception { - HttpRequest req = buildRequest(request, CreateAgentRequest.class, new TypeReference() {}); + HttpRequest req = + buildRequest(request, CreateAgentRequest.class, new TypeReference() {}); return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -214,49 +187,45 @@ public HttpResponse doRequest(CreateAgentRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public CreateAgentResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - CreateAgentResponse.Builder resBuilder = - CreateAgentResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + CreateAgentResponse.Builder resBuilder = CreateAgentResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); CreateAgentResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withAgent(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base implements AsyncRequestOperation { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -268,11 +237,13 @@ public Operations.CancellationRelay cancellationRelay() { } private CompletableFuture onBuildRequest(CreateAgentRequest request) throws Exception { - HttpRequest req = buildRequest(request, CreateAgentRequest.class, new TypeReference() {}); + HttpRequest req = + buildRequest(request, CreateAgentRequest.class, new TypeReference() {}); return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -287,51 +258,50 @@ public CompletableFuture> doRequest(CreateAgentRequest .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.CreateAgentResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.CreateAgentResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.CreateAgentResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.CreateAgentResponse - .builder() + com.google.genai.gaos.models.operations.async.CreateAgentResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.CreateAgentResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withAgent(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/CreateEnvironment.java b/src/main/java/com/google/genai/gaos/operations/CreateEnvironment.java index 59f52f6f5f9..f11afd8159d 100644 --- a/src/main/java/com/google/genai/gaos/operations/CreateEnvironment.java +++ b/src/main/java/com/google/genai/gaos/operations/CreateEnvironment.java @@ -19,15 +19,15 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; import com.google.genai.gaos.models.environments.Environment; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.CreateEnvironmentRequest; import com.google.genai.gaos.models.operations.CreateEnvironmentResponse; import com.google.genai.gaos.utils.AsyncRetries; @@ -45,8 +45,8 @@ import com.google.genai.gaos.utils.Retries; import com.google.genai.gaos.utils.RetryConfig; import com.google.genai.gaos.utils.SerializedBody; -import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils; +import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.transport.HttpRequest; import com.google.genai.gaos.utils.transport.HttpResponse; import jakarta.annotation.Nonnull; @@ -64,10 +64,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class CreateEnvironment { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -77,30 +76,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -133,28 +132,18 @@ AfterErrorContextImpl createAfterErrorContext() { java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/environments", - request, this.operationGlobals); + klass, this.baseUrl, "/{api_version}/environments", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - typeReference); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "body", - "json", - false); + Object convertedRequest = Utils.convertToShape(request, JsonShape.DEFAULT, typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody(convertedRequest, "body", "json", false); if (serializedRequestBody == null) { throw new IllegalArgumentException("Request body is required"); } req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -164,24 +153,21 @@ HttpRequest buildRequest(T request, Class klass, TypeReference typeR public static class Sync extends Base implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(CreateEnvironmentRequest request) throws Exception { - HttpRequest req = buildRequest(request, CreateEnvironmentRequest.class, new TypeReference() {}); + HttpRequest req = buildRequest( + request, CreateEnvironmentRequest.class, new TypeReference() {}); return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -214,49 +200,46 @@ public HttpResponse doRequest(CreateEnvironmentRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public CreateEnvironmentResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - CreateEnvironmentResponse.Builder resBuilder = - CreateEnvironmentResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + CreateEnvironmentResponse.Builder resBuilder = CreateEnvironmentResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); CreateEnvironmentResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withEnvironment(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base - implements AsyncRequestOperation { + implements AsyncRequestOperation< + CreateEnvironmentRequest, com.google.genai.gaos.models.operations.async.CreateEnvironmentResponse> { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -268,11 +251,13 @@ public Operations.CancellationRelay cancellationRelay() { } private CompletableFuture onBuildRequest(CreateEnvironmentRequest request) throws Exception { - HttpRequest req = buildRequest(request, CreateEnvironmentRequest.class, new TypeReference() {}); + HttpRequest req = buildRequest( + request, CreateEnvironmentRequest.class, new TypeReference() {}); return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -287,51 +272,50 @@ public CompletableFuture> doRequest(CreateEnvironmentR .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.CreateEnvironmentResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.CreateEnvironmentResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.CreateEnvironmentResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.CreateEnvironmentResponse - .builder() + com.google.genai.gaos.models.operations.async.CreateEnvironmentResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.CreateEnvironmentResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withEnvironment(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/CreateInteraction.java b/src/main/java/com/google/genai/gaos/operations/CreateInteraction.java index 836486971f2..469d5ecf2c6 100644 --- a/src/main/java/com/google/genai/gaos/operations/CreateInteraction.java +++ b/src/main/java/com/google/genai/gaos/operations/CreateInteraction.java @@ -19,16 +19,16 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; import com.google.genai.gaos.models.errors.CreateInteractionClientError; import com.google.genai.gaos.models.errors.CreateInteractionServerError; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.interactions.Interaction; import com.google.genai.gaos.models.operations.CreateInteractionRequest; import com.google.genai.gaos.models.operations.CreateInteractionResponse; @@ -47,8 +47,8 @@ import com.google.genai.gaos.utils.Retries; import com.google.genai.gaos.utils.RetryConfig; import com.google.genai.gaos.utils.SerializedBody; -import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils; +import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.transport.HttpRequest; import com.google.genai.gaos.utils.transport.HttpResponse; import jakarta.annotation.Nonnull; @@ -66,10 +66,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class CreateInteraction { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -79,30 +78,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -135,22 +134,13 @@ AfterErrorContextImpl createAfterErrorContext() { java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/interactions", - request, this.operationGlobals); + klass, this.baseUrl, "/{api_version}/interactions", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - typeReference); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "body", - "json", - false); + Object convertedRequest = Utils.convertToShape(request, JsonShape.DEFAULT, typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody(convertedRequest, "body", "json", false); if (serializedRequestBody == null) { throw new IllegalArgumentException("Request body is required"); } @@ -166,24 +156,21 @@ HttpRequest buildRequest(T request, Class klass, TypeReference typeR public static class Sync extends Base implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(CreateInteractionRequest request) throws Exception { - HttpRequest req = buildRequest(request, CreateInteractionRequest.class, new TypeReference() {}); + HttpRequest req = buildRequest( + request, CreateInteractionRequest.class, new TypeReference() {}); return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -216,59 +203,56 @@ public HttpResponse doRequest(CreateInteractionRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public CreateInteractionResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - CreateInteractionResponse.Builder resBuilder = - CreateInteractionResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + CreateInteractionResponse.Builder resBuilder = CreateInteractionResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); CreateInteractionResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withInteraction(Utils.unmarshal(response, new TypeReference() {})); } - if (Utils.contentTypeMatches(contentType, "text/event-stream")) { + if (Utils.contentTypeMatches(contentType, "text/event-stream")) { Utils.setSseSentinel(res, "[DONE]"); return res; } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { if (Utils.contentTypeMatches(contentType, "application/json")) { throw CreateInteractionClientError.from(response); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { if (Utils.contentTypeMatches(contentType, "application/json")) { throw CreateInteractionServerError.from(response); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base - implements AsyncRequestOperation { + implements AsyncRequestOperation< + CreateInteractionRequest, com.google.genai.gaos.models.operations.async.CreateInteractionResponse> { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -280,11 +264,13 @@ public Operations.CancellationRelay cancellationRelay() { } private CompletableFuture onBuildRequest(CreateInteractionRequest request) throws Exception { - HttpRequest req = buildRequest(request, CreateInteractionRequest.class, new TypeReference() {}); + HttpRequest req = buildRequest( + request, CreateInteractionRequest.class, new TypeReference() {}); return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -299,61 +285,60 @@ public CompletableFuture> doRequest(CreateInteractionR .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.CreateInteractionResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.CreateInteractionResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.CreateInteractionResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.CreateInteractionResponse - .builder() + com.google.genai.gaos.models.operations.async.CreateInteractionResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.CreateInteractionResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withInteraction(Utils.unmarshal(response, new TypeReference() {})); } - if (Utils.contentTypeMatches(contentType, "text/event-stream")) { + if (Utils.contentTypeMatches(contentType, "text/event-stream")) { Utils.setSseSentinel(res, "[DONE]"); return res; } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { if (Utils.contentTypeMatches(contentType, "application/json")) { throw CreateInteractionClientError.from(response); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { if (Utils.contentTypeMatches(contentType, "application/json")) { throw CreateInteractionServerError.from(response); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/CreateTrigger.java b/src/main/java/com/google/genai/gaos/operations/CreateTrigger.java index 2e0b8e7e60a..65cce08c479 100644 --- a/src/main/java/com/google/genai/gaos/operations/CreateTrigger.java +++ b/src/main/java/com/google/genai/gaos/operations/CreateTrigger.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.CreateTriggerRequest; import com.google.genai.gaos.models.operations.CreateTriggerResponse; import com.google.genai.gaos.models.triggers.Trigger; @@ -45,8 +45,8 @@ import com.google.genai.gaos.utils.Retries; import com.google.genai.gaos.utils.RetryConfig; import com.google.genai.gaos.utils.SerializedBody; -import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils; +import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.transport.HttpRequest; import com.google.genai.gaos.utils.transport.HttpResponse; import jakarta.annotation.Nonnull; @@ -64,10 +64,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class CreateTrigger { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -77,30 +76,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -109,52 +108,30 @@ Optional securitySource() { BeforeRequestContextImpl createBeforeRequestContext() { return new BeforeRequestContextImpl( - this.sdkConfiguration, - this.baseUrl, - "CreateTrigger", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "CreateTrigger", java.util.Optional.empty(), securitySource()); } AfterSuccessContextImpl createAfterSuccessContext() { return new AfterSuccessContextImpl( - this.sdkConfiguration, - this.baseUrl, - "CreateTrigger", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "CreateTrigger", java.util.Optional.empty(), securitySource()); } AfterErrorContextImpl createAfterErrorContext() { return new AfterErrorContextImpl( - this.sdkConfiguration, - this.baseUrl, - "CreateTrigger", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "CreateTrigger", java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { - String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/triggers", - request, this.operationGlobals); + + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + String url = + Utils.generateURL(klass, this.baseUrl, "/{api_version}/triggers", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - typeReference); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "body", - "json", - false); + Object convertedRequest = Utils.convertToShape(request, JsonShape.DEFAULT, typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody(convertedRequest, "body", "json", false); if (serializedRequestBody == null) { throw new IllegalArgumentException("Request body is required"); } req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -162,26 +139,22 @@ HttpRequest buildRequest(T request, Class klass, TypeReference typeR } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(CreateTriggerRequest request) throws Exception { - HttpRequest req = buildRequest(request, CreateTriggerRequest.class, new TypeReference() {}); + HttpRequest req = + buildRequest(request, CreateTriggerRequest.class, new TypeReference() {}); return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -214,49 +187,46 @@ public HttpResponse doRequest(CreateTriggerRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public CreateTriggerResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - CreateTriggerResponse.Builder resBuilder = - CreateTriggerResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + CreateTriggerResponse.Builder resBuilder = CreateTriggerResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); CreateTriggerResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withTrigger(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base - implements AsyncRequestOperation { + implements AsyncRequestOperation< + CreateTriggerRequest, com.google.genai.gaos.models.operations.async.CreateTriggerResponse> { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -268,11 +238,13 @@ public Operations.CancellationRelay cancellationRelay() { } private CompletableFuture onBuildRequest(CreateTriggerRequest request) throws Exception { - HttpRequest req = buildRequest(request, CreateTriggerRequest.class, new TypeReference() {}); + HttpRequest req = + buildRequest(request, CreateTriggerRequest.class, new TypeReference() {}); return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -287,51 +259,50 @@ public CompletableFuture> doRequest(CreateTriggerReque .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.CreateTriggerResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.CreateTriggerResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.CreateTriggerResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.CreateTriggerResponse - .builder() + com.google.genai.gaos.models.operations.async.CreateTriggerResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.CreateTriggerResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withTrigger(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/CreateWebhook.java b/src/main/java/com/google/genai/gaos/operations/CreateWebhook.java index 0f6515be02a..40b87ca7bcf 100644 --- a/src/main/java/com/google/genai/gaos/operations/CreateWebhook.java +++ b/src/main/java/com/google/genai/gaos/operations/CreateWebhook.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.CreateWebhookRequest; import com.google.genai.gaos.models.operations.CreateWebhookResponse; import com.google.genai.gaos.models.webhooks.Webhook; @@ -45,8 +45,8 @@ import com.google.genai.gaos.utils.Retries; import com.google.genai.gaos.utils.RetryConfig; import com.google.genai.gaos.utils.SerializedBody; -import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils; +import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.transport.HttpRequest; import com.google.genai.gaos.utils.transport.HttpResponse; import jakarta.annotation.Nonnull; @@ -64,10 +64,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class CreateWebhook { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -77,30 +76,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -109,52 +108,30 @@ Optional securitySource() { BeforeRequestContextImpl createBeforeRequestContext() { return new BeforeRequestContextImpl( - this.sdkConfiguration, - this.baseUrl, - "CreateWebhook", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "CreateWebhook", java.util.Optional.empty(), securitySource()); } AfterSuccessContextImpl createAfterSuccessContext() { return new AfterSuccessContextImpl( - this.sdkConfiguration, - this.baseUrl, - "CreateWebhook", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "CreateWebhook", java.util.Optional.empty(), securitySource()); } AfterErrorContextImpl createAfterErrorContext() { return new AfterErrorContextImpl( - this.sdkConfiguration, - this.baseUrl, - "CreateWebhook", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "CreateWebhook", java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { - String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/webhooks", - request, this.operationGlobals); + + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + String url = + Utils.generateURL(klass, this.baseUrl, "/{api_version}/webhooks", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - typeReference); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "body", - "json", - false); + Object convertedRequest = Utils.convertToShape(request, JsonShape.DEFAULT, typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody(convertedRequest, "body", "json", false); if (serializedRequestBody == null) { throw new IllegalArgumentException("Request body is required"); } req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -162,26 +139,22 @@ HttpRequest buildRequest(T request, Class klass, TypeReference typeR } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(CreateWebhookRequest request) throws Exception { - HttpRequest req = buildRequest(request, CreateWebhookRequest.class, new TypeReference() {}); + HttpRequest req = + buildRequest(request, CreateWebhookRequest.class, new TypeReference() {}); return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -214,49 +187,46 @@ public HttpResponse doRequest(CreateWebhookRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public CreateWebhookResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - CreateWebhookResponse.Builder resBuilder = - CreateWebhookResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + CreateWebhookResponse.Builder resBuilder = CreateWebhookResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); CreateWebhookResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withWebhook(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base - implements AsyncRequestOperation { + implements AsyncRequestOperation< + CreateWebhookRequest, com.google.genai.gaos.models.operations.async.CreateWebhookResponse> { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -268,11 +238,13 @@ public Operations.CancellationRelay cancellationRelay() { } private CompletableFuture onBuildRequest(CreateWebhookRequest request) throws Exception { - HttpRequest req = buildRequest(request, CreateWebhookRequest.class, new TypeReference() {}); + HttpRequest req = + buildRequest(request, CreateWebhookRequest.class, new TypeReference() {}); return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -287,51 +259,50 @@ public CompletableFuture> doRequest(CreateWebhookReque .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.CreateWebhookResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.CreateWebhookResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.CreateWebhookResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.CreateWebhookResponse - .builder() + com.google.genai.gaos.models.operations.async.CreateWebhookResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.CreateWebhookResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withWebhook(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/DeleteAgent.java b/src/main/java/com/google/genai/gaos/operations/DeleteAgent.java index 96ce109df86..3c7bf208554 100644 --- a/src/main/java/com/google/genai/gaos/operations/DeleteAgent.java +++ b/src/main/java/com/google/genai/gaos/operations/DeleteAgent.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.interactions.Empty; import com.google.genai.gaos.models.operations.DeleteAgentRequest; import com.google.genai.gaos.models.operations.DeleteAgentResponse; @@ -60,10 +60,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class DeleteAgent { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -73,30 +72,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -105,39 +104,24 @@ Optional securitySource() { BeforeRequestContextImpl createBeforeRequestContext() { return new BeforeRequestContextImpl( - this.sdkConfiguration, - this.baseUrl, - "DeleteAgent", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "DeleteAgent", java.util.Optional.empty(), securitySource()); } AfterSuccessContextImpl createAfterSuccessContext() { return new AfterSuccessContextImpl( - this.sdkConfiguration, - this.baseUrl, - "DeleteAgent", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "DeleteAgent", java.util.Optional.empty(), securitySource()); } AfterErrorContextImpl createAfterErrorContext() { return new AfterErrorContextImpl( - this.sdkConfiguration, - this.baseUrl, - "DeleteAgent", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "DeleteAgent", java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { - String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/agents/{id}", - request, this.operationGlobals); + + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = + Utils.generateURL(klass, this.baseUrl, "/{api_version}/agents/{id}", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "DELETE"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -145,14 +129,9 @@ HttpRequest buildRequest(T request, Class klass) throws Exception { } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(DeleteAgentRequest request) throws Exception { @@ -160,11 +139,11 @@ private HttpRequest onBuildRequest(DeleteAgentRequest request) throws Exception return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -197,49 +176,45 @@ public HttpResponse doRequest(DeleteAgentRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public DeleteAgentResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - DeleteAgentResponse.Builder resBuilder = - DeleteAgentResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + DeleteAgentResponse.Builder resBuilder = DeleteAgentResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); DeleteAgentResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withEmpty(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base implements AsyncRequestOperation { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -255,7 +230,8 @@ private CompletableFuture onBuildRequest(DeleteAgentRequest request return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -270,51 +246,50 @@ public CompletableFuture> doRequest(DeleteAgentRequest .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.DeleteAgentResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.DeleteAgentResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.DeleteAgentResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.DeleteAgentResponse - .builder() + com.google.genai.gaos.models.operations.async.DeleteAgentResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.DeleteAgentResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withEmpty(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/DeleteEnvironment.java b/src/main/java/com/google/genai/gaos/operations/DeleteEnvironment.java index 1611185575b..fc0316a99be 100644 --- a/src/main/java/com/google/genai/gaos/operations/DeleteEnvironment.java +++ b/src/main/java/com/google/genai/gaos/operations/DeleteEnvironment.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.interactions.Empty; import com.google.genai.gaos.models.operations.DeleteEnvironmentRequest; import com.google.genai.gaos.models.operations.DeleteEnvironmentResponse; @@ -60,10 +60,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class DeleteEnvironment { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -73,30 +72,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -129,15 +128,12 @@ AfterErrorContextImpl createAfterErrorContext() { java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { + + HttpRequest buildRequest(T request, Class klass) throws Exception { String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/environments/{id}", - request, this.operationGlobals); + klass, this.baseUrl, "/{api_version}/environments/{id}", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "DELETE"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -147,12 +143,8 @@ HttpRequest buildRequest(T request, Class klass) throws Exception { public static class Sync extends Base implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(DeleteEnvironmentRequest request) throws Exception { @@ -160,11 +152,11 @@ private HttpRequest onBuildRequest(DeleteEnvironmentRequest request) throws Exce return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -197,49 +189,46 @@ public HttpResponse doRequest(DeleteEnvironmentRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public DeleteEnvironmentResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - DeleteEnvironmentResponse.Builder resBuilder = - DeleteEnvironmentResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + DeleteEnvironmentResponse.Builder resBuilder = DeleteEnvironmentResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); DeleteEnvironmentResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withEmpty(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base - implements AsyncRequestOperation { + implements AsyncRequestOperation< + DeleteEnvironmentRequest, com.google.genai.gaos.models.operations.async.DeleteEnvironmentResponse> { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -255,7 +244,8 @@ private CompletableFuture onBuildRequest(DeleteEnvironmentRequest r return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -270,51 +260,50 @@ public CompletableFuture> doRequest(DeleteEnvironmentR .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.DeleteEnvironmentResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.DeleteEnvironmentResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.DeleteEnvironmentResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.DeleteEnvironmentResponse - .builder() + com.google.genai.gaos.models.operations.async.DeleteEnvironmentResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.DeleteEnvironmentResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withEmpty(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/DeleteInteraction.java b/src/main/java/com/google/genai/gaos/operations/DeleteInteraction.java index 94d7a27c986..a1521dcfe6e 100644 --- a/src/main/java/com/google/genai/gaos/operations/DeleteInteraction.java +++ b/src/main/java/com/google/genai/gaos/operations/DeleteInteraction.java @@ -19,15 +19,15 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; import com.google.genai.gaos.models.errors.DeleteInteractionClientError; import com.google.genai.gaos.models.errors.DeleteInteractionServerError; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.DeleteInteractionRequest; import com.google.genai.gaos.models.operations.DeleteInteractionResponse; import com.google.genai.gaos.utils.AsyncRetries; @@ -60,10 +60,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class DeleteInteraction { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -73,30 +72,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -129,15 +128,12 @@ AfterErrorContextImpl createAfterErrorContext() { java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { + + HttpRequest buildRequest(T request, Class klass) throws Exception { String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/interactions/{id}", - request, this.operationGlobals); + klass, this.baseUrl, "/{api_version}/interactions/{id}", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "DELETE"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -147,12 +143,8 @@ HttpRequest buildRequest(T request, Class klass) throws Exception { public static class Sync extends Base implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(DeleteInteractionRequest request) throws Exception { @@ -160,11 +152,11 @@ private HttpRequest onBuildRequest(DeleteInteractionRequest request) throws Exce return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -197,21 +189,16 @@ public HttpResponse doRequest(DeleteInteractionRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public DeleteInteractionResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - DeleteInteractionResponse.Builder resBuilder = - DeleteInteractionResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + DeleteInteractionResponse.Builder resBuilder = DeleteInteractionResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); DeleteInteractionResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { // no content Utils.closeQuietly(response.body()); @@ -221,29 +208,31 @@ public DeleteInteractionResponse handleResponse(HttpResponse respon if (Utils.contentTypeMatches(contentType, "application/json")) { throw DeleteInteractionClientError.from(response); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { if (Utils.contentTypeMatches(contentType, "application/json")) { throw DeleteInteractionServerError.from(response); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base - implements AsyncRequestOperation { + implements AsyncRequestOperation< + DeleteInteractionRequest, com.google.genai.gaos.models.operations.async.DeleteInteractionResponse> { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -259,7 +248,8 @@ private CompletableFuture onBuildRequest(DeleteInteractionRequest r return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -274,35 +264,34 @@ public CompletableFuture> doRequest(DeleteInteractionR .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.DeleteInteractionResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.DeleteInteractionResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.DeleteInteractionResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.DeleteInteractionResponse - .builder() + com.google.genai.gaos.models.operations.async.DeleteInteractionResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.DeleteInteractionResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { // no content Utils.closeQuietly(response.body()); @@ -312,17 +301,17 @@ public com.google.genai.gaos.models.operations.async.DeleteInteractionResponse h if (Utils.contentTypeMatches(contentType, "application/json")) { throw DeleteInteractionClientError.from(response); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { if (Utils.contentTypeMatches(contentType, "application/json")) { throw DeleteInteractionServerError.from(response); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/DeleteTrigger.java b/src/main/java/com/google/genai/gaos/operations/DeleteTrigger.java index d8de8f54c31..22dcc1b2fbd 100644 --- a/src/main/java/com/google/genai/gaos/operations/DeleteTrigger.java +++ b/src/main/java/com/google/genai/gaos/operations/DeleteTrigger.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.interactions.Empty; import com.google.genai.gaos.models.operations.DeleteTriggerRequest; import com.google.genai.gaos.models.operations.DeleteTriggerResponse; @@ -60,10 +60,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class DeleteTrigger { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -73,30 +72,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -105,39 +104,24 @@ Optional securitySource() { BeforeRequestContextImpl createBeforeRequestContext() { return new BeforeRequestContextImpl( - this.sdkConfiguration, - this.baseUrl, - "DeleteTrigger", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "DeleteTrigger", java.util.Optional.empty(), securitySource()); } AfterSuccessContextImpl createAfterSuccessContext() { return new AfterSuccessContextImpl( - this.sdkConfiguration, - this.baseUrl, - "DeleteTrigger", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "DeleteTrigger", java.util.Optional.empty(), securitySource()); } AfterErrorContextImpl createAfterErrorContext() { return new AfterErrorContextImpl( - this.sdkConfiguration, - this.baseUrl, - "DeleteTrigger", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "DeleteTrigger", java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { + + HttpRequest buildRequest(T request, Class klass) throws Exception { String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/triggers/{id}", - request, this.operationGlobals); + klass, this.baseUrl, "/{api_version}/triggers/{id}", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "DELETE"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -145,14 +129,9 @@ HttpRequest buildRequest(T request, Class klass) throws Exception { } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(DeleteTriggerRequest request) throws Exception { @@ -160,11 +139,11 @@ private HttpRequest onBuildRequest(DeleteTriggerRequest request) throws Exceptio return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -197,49 +176,46 @@ public HttpResponse doRequest(DeleteTriggerRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public DeleteTriggerResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - DeleteTriggerResponse.Builder resBuilder = - DeleteTriggerResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + DeleteTriggerResponse.Builder resBuilder = DeleteTriggerResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); DeleteTriggerResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withEmpty(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base - implements AsyncRequestOperation { + implements AsyncRequestOperation< + DeleteTriggerRequest, com.google.genai.gaos.models.operations.async.DeleteTriggerResponse> { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -255,7 +231,8 @@ private CompletableFuture onBuildRequest(DeleteTriggerRequest reque return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -270,51 +247,50 @@ public CompletableFuture> doRequest(DeleteTriggerReque .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.DeleteTriggerResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.DeleteTriggerResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.DeleteTriggerResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.DeleteTriggerResponse - .builder() + com.google.genai.gaos.models.operations.async.DeleteTriggerResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.DeleteTriggerResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withEmpty(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/DeleteWebhook.java b/src/main/java/com/google/genai/gaos/operations/DeleteWebhook.java index d6de2853e66..51582a5d5cf 100644 --- a/src/main/java/com/google/genai/gaos/operations/DeleteWebhook.java +++ b/src/main/java/com/google/genai/gaos/operations/DeleteWebhook.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.interactions.Empty; import com.google.genai.gaos.models.operations.DeleteWebhookRequest; import com.google.genai.gaos.models.operations.DeleteWebhookResponse; @@ -60,10 +60,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class DeleteWebhook { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -73,30 +72,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -105,39 +104,24 @@ Optional securitySource() { BeforeRequestContextImpl createBeforeRequestContext() { return new BeforeRequestContextImpl( - this.sdkConfiguration, - this.baseUrl, - "DeleteWebhook", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "DeleteWebhook", java.util.Optional.empty(), securitySource()); } AfterSuccessContextImpl createAfterSuccessContext() { return new AfterSuccessContextImpl( - this.sdkConfiguration, - this.baseUrl, - "DeleteWebhook", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "DeleteWebhook", java.util.Optional.empty(), securitySource()); } AfterErrorContextImpl createAfterErrorContext() { return new AfterErrorContextImpl( - this.sdkConfiguration, - this.baseUrl, - "DeleteWebhook", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "DeleteWebhook", java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { + + HttpRequest buildRequest(T request, Class klass) throws Exception { String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/webhooks/{id}", - request, this.operationGlobals); + klass, this.baseUrl, "/{api_version}/webhooks/{id}", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "DELETE"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -145,14 +129,9 @@ HttpRequest buildRequest(T request, Class klass) throws Exception { } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(DeleteWebhookRequest request) throws Exception { @@ -160,11 +139,11 @@ private HttpRequest onBuildRequest(DeleteWebhookRequest request) throws Exceptio return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -197,49 +176,46 @@ public HttpResponse doRequest(DeleteWebhookRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public DeleteWebhookResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - DeleteWebhookResponse.Builder resBuilder = - DeleteWebhookResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + DeleteWebhookResponse.Builder resBuilder = DeleteWebhookResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); DeleteWebhookResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withEmpty(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base - implements AsyncRequestOperation { + implements AsyncRequestOperation< + DeleteWebhookRequest, com.google.genai.gaos.models.operations.async.DeleteWebhookResponse> { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -255,7 +231,8 @@ private CompletableFuture onBuildRequest(DeleteWebhookRequest reque return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -270,51 +247,50 @@ public CompletableFuture> doRequest(DeleteWebhookReque .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.DeleteWebhookResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.DeleteWebhookResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.DeleteWebhookResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.DeleteWebhookResponse - .builder() + com.google.genai.gaos.models.operations.async.DeleteWebhookResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.DeleteWebhookResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withEmpty(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/GetAgent.java b/src/main/java/com/google/genai/gaos/operations/GetAgent.java index 6366bd2917c..2d18d573d69 100644 --- a/src/main/java/com/google/genai/gaos/operations/GetAgent.java +++ b/src/main/java/com/google/genai/gaos/operations/GetAgent.java @@ -19,15 +19,15 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; import com.google.genai.gaos.models.agents.Agent; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.GetAgentRequest; import com.google.genai.gaos.models.operations.GetAgentResponse; import com.google.genai.gaos.utils.AsyncRetries; @@ -60,10 +60,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class GetAgent { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -73,30 +72,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -105,39 +104,24 @@ Optional securitySource() { BeforeRequestContextImpl createBeforeRequestContext() { return new BeforeRequestContextImpl( - this.sdkConfiguration, - this.baseUrl, - "GetAgent", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "GetAgent", java.util.Optional.empty(), securitySource()); } AfterSuccessContextImpl createAfterSuccessContext() { return new AfterSuccessContextImpl( - this.sdkConfiguration, - this.baseUrl, - "GetAgent", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "GetAgent", java.util.Optional.empty(), securitySource()); } AfterErrorContextImpl createAfterErrorContext() { return new AfterErrorContextImpl( - this.sdkConfiguration, - this.baseUrl, - "GetAgent", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "GetAgent", java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { - String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/agents/{id}", - request, this.operationGlobals); + + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = + Utils.generateURL(klass, this.baseUrl, "/{api_version}/agents/{id}", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -145,14 +129,9 @@ HttpRequest buildRequest(T request, Class klass) throws Exception { } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(GetAgentRequest request) throws Exception { @@ -160,11 +139,11 @@ private HttpRequest onBuildRequest(GetAgentRequest request) throws Exception { return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -197,49 +176,45 @@ public HttpResponse doRequest(GetAgentRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public GetAgentResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - GetAgentResponse.Builder resBuilder = - GetAgentResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + GetAgentResponse.Builder resBuilder = GetAgentResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); GetAgentResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withAgent(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base implements AsyncRequestOperation { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -255,7 +230,8 @@ private CompletableFuture onBuildRequest(GetAgentRequest request) t return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -270,51 +246,50 @@ public CompletableFuture> doRequest(GetAgentRequest re .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.GetAgentResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.GetAgentResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.GetAgentResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.GetAgentResponse - .builder() + com.google.genai.gaos.models.operations.async.GetAgentResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.GetAgentResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withAgent(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/GetEnvironment.java b/src/main/java/com/google/genai/gaos/operations/GetEnvironment.java index 978fbe6d1f8..ad04273d462 100644 --- a/src/main/java/com/google/genai/gaos/operations/GetEnvironment.java +++ b/src/main/java/com/google/genai/gaos/operations/GetEnvironment.java @@ -19,15 +19,15 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; import com.google.genai.gaos.models.environments.Environment; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.GetEnvironmentRequest; import com.google.genai.gaos.models.operations.GetEnvironmentResponse; import com.google.genai.gaos.utils.AsyncRetries; @@ -60,10 +60,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class GetEnvironment { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -73,30 +72,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -129,15 +128,12 @@ AfterErrorContextImpl createAfterErrorContext() { java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { + + HttpRequest buildRequest(T request, Class klass) throws Exception { String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/environments/{id}", - request, this.operationGlobals); + klass, this.baseUrl, "/{api_version}/environments/{id}", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -145,14 +141,9 @@ HttpRequest buildRequest(T request, Class klass) throws Exception { } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(GetEnvironmentRequest request) throws Exception { @@ -160,11 +151,11 @@ private HttpRequest onBuildRequest(GetEnvironmentRequest request) throws Excepti return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -197,49 +188,46 @@ public HttpResponse doRequest(GetEnvironmentRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public GetEnvironmentResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - GetEnvironmentResponse.Builder resBuilder = - GetEnvironmentResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + GetEnvironmentResponse.Builder resBuilder = GetEnvironmentResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); GetEnvironmentResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withEnvironment(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base - implements AsyncRequestOperation { + implements AsyncRequestOperation< + GetEnvironmentRequest, com.google.genai.gaos.models.operations.async.GetEnvironmentResponse> { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -255,7 +243,8 @@ private CompletableFuture onBuildRequest(GetEnvironmentRequest requ return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -270,51 +259,50 @@ public CompletableFuture> doRequest(GetEnvironmentRequ .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.GetEnvironmentResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.GetEnvironmentResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.GetEnvironmentResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.GetEnvironmentResponse - .builder() + com.google.genai.gaos.models.operations.async.GetEnvironmentResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.GetEnvironmentResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withEnvironment(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/GetInteractionById.java b/src/main/java/com/google/genai/gaos/operations/GetInteractionById.java index a71b9ea207d..a5c1e9b7bc1 100644 --- a/src/main/java/com/google/genai/gaos/operations/GetInteractionById.java +++ b/src/main/java/com/google/genai/gaos/operations/GetInteractionById.java @@ -19,16 +19,16 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.errors.GetInteractionByIdClientError; import com.google.genai.gaos.models.errors.GetInteractionByIdServerError; -import com.google.genai.gaos.models.errors.SDKException; import com.google.genai.gaos.models.interactions.Interaction; import com.google.genai.gaos.models.operations.GetInteractionByIdRequest; import com.google.genai.gaos.models.operations.GetInteractionByIdResponse; @@ -62,10 +62,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class GetInteractionById { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -75,30 +74,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -131,21 +130,16 @@ AfterErrorContextImpl createAfterErrorContext() { java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { + + HttpRequest buildRequest(T request, Class klass) throws Exception { String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/interactions/{id}", - request, this.operationGlobals); + klass, this.baseUrl, "/{api_version}/interactions/{id}", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "GET"); req.addHeader("Accept", "application/json;q=1, text/event-stream;q=0") .addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); - req.addQueryParams(Utils.getQueryParams( - klass, - request, - this.operationGlobals)); + req.addQueryParams(Utils.getQueryParams(klass, request, this.operationGlobals)); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); return req.build(); @@ -154,12 +148,8 @@ HttpRequest buildRequest(T request, Class klass) throws Exception { public static class Sync extends Base implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(GetInteractionByIdRequest request) throws Exception { @@ -167,11 +157,11 @@ private HttpRequest onBuildRequest(GetInteractionByIdRequest request) throws Exc return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -204,59 +194,56 @@ public HttpResponse doRequest(GetInteractionByIdRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public GetInteractionByIdResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - GetInteractionByIdResponse.Builder resBuilder = - GetInteractionByIdResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + GetInteractionByIdResponse.Builder resBuilder = GetInteractionByIdResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); GetInteractionByIdResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withInteraction(Utils.unmarshal(response, new TypeReference() {})); } - if (Utils.contentTypeMatches(contentType, "text/event-stream")) { + if (Utils.contentTypeMatches(contentType, "text/event-stream")) { Utils.setSseSentinel(res, "[DONE]"); return res; } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { if (Utils.contentTypeMatches(contentType, "application/json")) { throw GetInteractionByIdClientError.from(response); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { if (Utils.contentTypeMatches(contentType, "application/json")) { throw GetInteractionByIdServerError.from(response); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base - implements AsyncRequestOperation { + implements AsyncRequestOperation< + GetInteractionByIdRequest, com.google.genai.gaos.models.operations.async.GetInteractionByIdResponse> { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -272,7 +259,8 @@ private CompletableFuture onBuildRequest(GetInteractionByIdRequest return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -287,61 +275,60 @@ public CompletableFuture> doRequest(GetInteractionById .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.GetInteractionByIdResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.GetInteractionByIdResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.GetInteractionByIdResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.GetInteractionByIdResponse - .builder() + com.google.genai.gaos.models.operations.async.GetInteractionByIdResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.GetInteractionByIdResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withInteraction(Utils.unmarshal(response, new TypeReference() {})); } - if (Utils.contentTypeMatches(contentType, "text/event-stream")) { + if (Utils.contentTypeMatches(contentType, "text/event-stream")) { Utils.setSseSentinel(res, "[DONE]"); return res; } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { if (Utils.contentTypeMatches(contentType, "application/json")) { throw GetInteractionByIdClientError.from(response); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { if (Utils.contentTypeMatches(contentType, "application/json")) { throw GetInteractionByIdServerError.from(response); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/GetTrigger.java b/src/main/java/com/google/genai/gaos/operations/GetTrigger.java index f9579438e24..7911d886030 100644 --- a/src/main/java/com/google/genai/gaos/operations/GetTrigger.java +++ b/src/main/java/com/google/genai/gaos/operations/GetTrigger.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.GetTriggerRequest; import com.google.genai.gaos.models.operations.GetTriggerResponse; import com.google.genai.gaos.models.triggers.Trigger; @@ -60,10 +60,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class GetTrigger { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -73,30 +72,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -105,39 +104,24 @@ Optional securitySource() { BeforeRequestContextImpl createBeforeRequestContext() { return new BeforeRequestContextImpl( - this.sdkConfiguration, - this.baseUrl, - "GetTrigger", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "GetTrigger", java.util.Optional.empty(), securitySource()); } AfterSuccessContextImpl createAfterSuccessContext() { return new AfterSuccessContextImpl( - this.sdkConfiguration, - this.baseUrl, - "GetTrigger", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "GetTrigger", java.util.Optional.empty(), securitySource()); } AfterErrorContextImpl createAfterErrorContext() { return new AfterErrorContextImpl( - this.sdkConfiguration, - this.baseUrl, - "GetTrigger", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "GetTrigger", java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { + + HttpRequest buildRequest(T request, Class klass) throws Exception { String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/triggers/{id}", - request, this.operationGlobals); + klass, this.baseUrl, "/{api_version}/triggers/{id}", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -145,14 +129,9 @@ HttpRequest buildRequest(T request, Class klass) throws Exception { } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(GetTriggerRequest request) throws Exception { @@ -160,11 +139,11 @@ private HttpRequest onBuildRequest(GetTriggerRequest request) throws Exception { return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -197,49 +176,45 @@ public HttpResponse doRequest(GetTriggerRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public GetTriggerResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - GetTriggerResponse.Builder resBuilder = - GetTriggerResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + GetTriggerResponse.Builder resBuilder = GetTriggerResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); GetTriggerResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withTrigger(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base implements AsyncRequestOperation { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -255,7 +230,8 @@ private CompletableFuture onBuildRequest(GetTriggerRequest request) return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -270,51 +246,50 @@ public CompletableFuture> doRequest(GetTriggerRequest .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.GetTriggerResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.GetTriggerResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.GetTriggerResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.GetTriggerResponse - .builder() + com.google.genai.gaos.models.operations.async.GetTriggerResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.GetTriggerResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withTrigger(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/GetWebhook.java b/src/main/java/com/google/genai/gaos/operations/GetWebhook.java index 979555c6423..7c5a1982ed5 100644 --- a/src/main/java/com/google/genai/gaos/operations/GetWebhook.java +++ b/src/main/java/com/google/genai/gaos/operations/GetWebhook.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.GetWebhookRequest; import com.google.genai.gaos.models.operations.GetWebhookResponse; import com.google.genai.gaos.models.webhooks.Webhook; @@ -60,10 +60,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class GetWebhook { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -73,30 +72,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -105,39 +104,24 @@ Optional securitySource() { BeforeRequestContextImpl createBeforeRequestContext() { return new BeforeRequestContextImpl( - this.sdkConfiguration, - this.baseUrl, - "GetWebhook", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "GetWebhook", java.util.Optional.empty(), securitySource()); } AfterSuccessContextImpl createAfterSuccessContext() { return new AfterSuccessContextImpl( - this.sdkConfiguration, - this.baseUrl, - "GetWebhook", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "GetWebhook", java.util.Optional.empty(), securitySource()); } AfterErrorContextImpl createAfterErrorContext() { return new AfterErrorContextImpl( - this.sdkConfiguration, - this.baseUrl, - "GetWebhook", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "GetWebhook", java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { + + HttpRequest buildRequest(T request, Class klass) throws Exception { String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/webhooks/{id}", - request, this.operationGlobals); + klass, this.baseUrl, "/{api_version}/webhooks/{id}", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -145,14 +129,9 @@ HttpRequest buildRequest(T request, Class klass) throws Exception { } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(GetWebhookRequest request) throws Exception { @@ -160,11 +139,11 @@ private HttpRequest onBuildRequest(GetWebhookRequest request) throws Exception { return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -197,49 +176,45 @@ public HttpResponse doRequest(GetWebhookRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public GetWebhookResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - GetWebhookResponse.Builder resBuilder = - GetWebhookResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + GetWebhookResponse.Builder resBuilder = GetWebhookResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); GetWebhookResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withWebhook(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base implements AsyncRequestOperation { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -255,7 +230,8 @@ private CompletableFuture onBuildRequest(GetWebhookRequest request) return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -270,51 +246,50 @@ public CompletableFuture> doRequest(GetWebhookRequest .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.GetWebhookResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.GetWebhookResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.GetWebhookResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.GetWebhookResponse - .builder() + com.google.genai.gaos.models.operations.async.GetWebhookResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.GetWebhookResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withWebhook(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/ListAgents.java b/src/main/java/com/google/genai/gaos/operations/ListAgents.java index de5700c05c7..339b727858f 100644 --- a/src/main/java/com/google/genai/gaos/operations/ListAgents.java +++ b/src/main/java/com/google/genai/gaos/operations/ListAgents.java @@ -19,15 +19,15 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; import com.google.genai.gaos.models.agents.AgentListResponse; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.ListAgentsRequest; import com.google.genai.gaos.models.operations.ListAgentsResponse; import com.google.genai.gaos.utils.AsyncRetries; @@ -60,10 +60,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class ListAgents { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -73,30 +72,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -105,59 +104,36 @@ Optional securitySource() { BeforeRequestContextImpl createBeforeRequestContext() { return new BeforeRequestContextImpl( - this.sdkConfiguration, - this.baseUrl, - "ListAgents", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "ListAgents", java.util.Optional.empty(), securitySource()); } AfterSuccessContextImpl createAfterSuccessContext() { return new AfterSuccessContextImpl( - this.sdkConfiguration, - this.baseUrl, - "ListAgents", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "ListAgents", java.util.Optional.empty(), securitySource()); } AfterErrorContextImpl createAfterErrorContext() { return new AfterErrorContextImpl( - this.sdkConfiguration, - this.baseUrl, - "ListAgents", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "ListAgents", java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { - String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/agents", - request, this.operationGlobals); + + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = + Utils.generateURL(klass, this.baseUrl, "/{api_version}/agents", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); - req.addQueryParams(Utils.getQueryParams( - klass, - request, - this.operationGlobals)); + req.addQueryParams(Utils.getQueryParams(klass, request, this.operationGlobals)); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); return req.build(); } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(ListAgentsRequest request) throws Exception { @@ -165,11 +141,11 @@ private HttpRequest onBuildRequest(ListAgentsRequest request) throws Exception { return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -202,49 +178,46 @@ public HttpResponse doRequest(ListAgentsRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public ListAgentsResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - ListAgentsResponse.Builder resBuilder = - ListAgentsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + ListAgentsResponse.Builder resBuilder = ListAgentsResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); ListAgentsResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - return res.withAgentListResponse(Utils.unmarshal(response, new TypeReference() {})); + return res.withAgentListResponse( + Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base implements AsyncRequestOperation { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -260,7 +233,8 @@ private CompletableFuture onBuildRequest(ListAgentsRequest request) return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -275,51 +249,51 @@ public CompletableFuture> doRequest(ListAgentsRequest .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.ListAgentsResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.ListAgentsResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.ListAgentsResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.ListAgentsResponse - .builder() + com.google.genai.gaos.models.operations.async.ListAgentsResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.ListAgentsResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - return res.withAgentListResponse(Utils.unmarshal(response, new TypeReference() {})); + return res.withAgentListResponse( + Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/ListEnvironments.java b/src/main/java/com/google/genai/gaos/operations/ListEnvironments.java index 409e7d24379..d599f4ae7af 100644 --- a/src/main/java/com/google/genai/gaos/operations/ListEnvironments.java +++ b/src/main/java/com/google/genai/gaos/operations/ListEnvironments.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.ListEnvironmentsRequest; import com.google.genai.gaos.models.operations.ListEnvironmentsResponse; import com.google.genai.gaos.utils.AsyncRetries; @@ -59,10 +59,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class ListEnvironments { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -72,30 +71,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -128,21 +127,15 @@ AfterErrorContextImpl createAfterErrorContext() { java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { + + HttpRequest buildRequest(T request, Class klass) throws Exception { String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/environments", - request, this.operationGlobals); + klass, this.baseUrl, "/{api_version}/environments", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); - req.addQueryParams(Utils.getQueryParams( - klass, - request, - this.operationGlobals)); + req.addQueryParams(Utils.getQueryParams(klass, request, this.operationGlobals)); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); return req.build(); @@ -151,12 +144,8 @@ HttpRequest buildRequest(T request, Class klass) throws Exception { public static class Sync extends Base implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(ListEnvironmentsRequest request) throws Exception { @@ -164,11 +153,11 @@ private HttpRequest onBuildRequest(ListEnvironmentsRequest request) throws Excep return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -201,49 +190,48 @@ public HttpResponse doRequest(ListEnvironmentsRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public ListEnvironmentsResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - ListEnvironmentsResponse.Builder resBuilder = - ListEnvironmentsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + ListEnvironmentsResponse.Builder resBuilder = ListEnvironmentsResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); ListEnvironmentsResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - return res.withListEnvironmentsResponse(Utils.unmarshal(response, new TypeReference() {})); + return res.withListEnvironmentsResponse(Utils.unmarshal( + response, + new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base - implements AsyncRequestOperation { + implements AsyncRequestOperation< + ListEnvironmentsRequest, com.google.genai.gaos.models.operations.async.ListEnvironmentsResponse> { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -259,7 +247,8 @@ private CompletableFuture onBuildRequest(ListEnvironmentsRequest re return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -274,51 +263,52 @@ public CompletableFuture> doRequest(ListEnvironmentsRe .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.ListEnvironmentsResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.ListEnvironmentsResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.ListEnvironmentsResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.ListEnvironmentsResponse - .builder() + com.google.genai.gaos.models.operations.async.ListEnvironmentsResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.ListEnvironmentsResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - return res.withListEnvironmentsResponse(Utils.unmarshal(response, new TypeReference() {})); + return res.withListEnvironmentsResponse(Utils.unmarshal( + response, + new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/ListTriggerExecutions.java b/src/main/java/com/google/genai/gaos/operations/ListTriggerExecutions.java index 59646ebe9bd..ca75642509e 100644 --- a/src/main/java/com/google/genai/gaos/operations/ListTriggerExecutions.java +++ b/src/main/java/com/google/genai/gaos/operations/ListTriggerExecutions.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.ListTriggerExecutionsRequest; import com.google.genai.gaos.models.operations.ListTriggerExecutionsResponse; import com.google.genai.gaos.utils.AsyncRetries; @@ -59,10 +59,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class ListTriggerExecutions { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -72,30 +71,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -128,21 +127,19 @@ AfterErrorContextImpl createAfterErrorContext() { java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { + + HttpRequest buildRequest(T request, Class klass) throws Exception { String url = Utils.generateURL( klass, this.baseUrl, "/{api_version}/triggers/{trigger_id}/executions", - request, this.operationGlobals); + request, + this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); - req.addQueryParams(Utils.getQueryParams( - klass, - request, - this.operationGlobals)); + req.addQueryParams(Utils.getQueryParams(klass, request, this.operationGlobals)); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); return req.build(); @@ -151,12 +148,8 @@ HttpRequest buildRequest(T request, Class klass) throws Exception { public static class Sync extends Base implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(ListTriggerExecutionsRequest request) throws Exception { @@ -164,11 +157,11 @@ private HttpRequest onBuildRequest(ListTriggerExecutionsRequest request) throws return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -201,49 +194,49 @@ public HttpResponse doRequest(ListTriggerExecutionsRequest request) return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public ListTriggerExecutionsResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - ListTriggerExecutionsResponse.Builder resBuilder = - ListTriggerExecutionsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + ListTriggerExecutionsResponse.Builder resBuilder = ListTriggerExecutionsResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); ListTriggerExecutionsResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - return res.withListTriggerExecutionsResponse(Utils.unmarshal(response, new TypeReference() {})); + return res.withListTriggerExecutionsResponse(Utils.unmarshal( + response, + new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base - implements AsyncRequestOperation { + implements AsyncRequestOperation< + ListTriggerExecutionsRequest, + com.google.genai.gaos.models.operations.async.ListTriggerExecutionsResponse> { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -259,7 +252,8 @@ private CompletableFuture onBuildRequest(ListTriggerExecutionsReque return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -274,51 +268,52 @@ public CompletableFuture> doRequest(ListTriggerExecuti .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.ListTriggerExecutionsResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.ListTriggerExecutionsResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.ListTriggerExecutionsResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.ListTriggerExecutionsResponse - .builder() + com.google.genai.gaos.models.operations.async.ListTriggerExecutionsResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.ListTriggerExecutionsResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - return res.withListTriggerExecutionsResponse(Utils.unmarshal(response, new TypeReference() {})); + return res.withListTriggerExecutionsResponse(Utils.unmarshal( + response, + new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/ListTriggers.java b/src/main/java/com/google/genai/gaos/operations/ListTriggers.java index 57e9f1bc6ff..ac28045d96e 100644 --- a/src/main/java/com/google/genai/gaos/operations/ListTriggers.java +++ b/src/main/java/com/google/genai/gaos/operations/ListTriggers.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.ListTriggersRequest; import com.google.genai.gaos.models.operations.ListTriggersResponse; import com.google.genai.gaos.utils.AsyncRetries; @@ -59,10 +59,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class ListTriggers { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -72,30 +71,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -104,59 +103,36 @@ Optional securitySource() { BeforeRequestContextImpl createBeforeRequestContext() { return new BeforeRequestContextImpl( - this.sdkConfiguration, - this.baseUrl, - "ListTriggers", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "ListTriggers", java.util.Optional.empty(), securitySource()); } AfterSuccessContextImpl createAfterSuccessContext() { return new AfterSuccessContextImpl( - this.sdkConfiguration, - this.baseUrl, - "ListTriggers", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "ListTriggers", java.util.Optional.empty(), securitySource()); } AfterErrorContextImpl createAfterErrorContext() { return new AfterErrorContextImpl( - this.sdkConfiguration, - this.baseUrl, - "ListTriggers", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "ListTriggers", java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { - String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/triggers", - request, this.operationGlobals); + + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = + Utils.generateURL(klass, this.baseUrl, "/{api_version}/triggers", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); - req.addQueryParams(Utils.getQueryParams( - klass, - request, - this.operationGlobals)); + req.addQueryParams(Utils.getQueryParams(klass, request, this.operationGlobals)); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); return req.build(); } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(ListTriggersRequest request) throws Exception { @@ -164,11 +140,11 @@ private HttpRequest onBuildRequest(ListTriggersRequest request) throws Exception return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -201,49 +177,46 @@ public HttpResponse doRequest(ListTriggersRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public ListTriggersResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - ListTriggersResponse.Builder resBuilder = - ListTriggersResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + ListTriggersResponse.Builder resBuilder = ListTriggersResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); ListTriggersResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - return res.withListTriggersResponse(Utils.unmarshal(response, new TypeReference() {})); + return res.withListTriggersResponse(Utils.unmarshal( + response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base implements AsyncRequestOperation { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -259,7 +232,8 @@ private CompletableFuture onBuildRequest(ListTriggersRequest reques return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -274,51 +248,51 @@ public CompletableFuture> doRequest(ListTriggersReques .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.ListTriggersResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.ListTriggersResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.ListTriggersResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.ListTriggersResponse - .builder() + com.google.genai.gaos.models.operations.async.ListTriggersResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.ListTriggersResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - return res.withListTriggersResponse(Utils.unmarshal(response, new TypeReference() {})); + return res.withListTriggersResponse(Utils.unmarshal( + response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/ListWebhooks.java b/src/main/java/com/google/genai/gaos/operations/ListWebhooks.java index e54ce766142..14c15c83df5 100644 --- a/src/main/java/com/google/genai/gaos/operations/ListWebhooks.java +++ b/src/main/java/com/google/genai/gaos/operations/ListWebhooks.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.ListWebhooksRequest; import com.google.genai.gaos.models.operations.ListWebhooksResponse; import com.google.genai.gaos.models.webhooks.WebhookListResponse; @@ -60,10 +60,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class ListWebhooks { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -73,30 +72,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -105,59 +104,36 @@ Optional securitySource() { BeforeRequestContextImpl createBeforeRequestContext() { return new BeforeRequestContextImpl( - this.sdkConfiguration, - this.baseUrl, - "ListWebhooks", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "ListWebhooks", java.util.Optional.empty(), securitySource()); } AfterSuccessContextImpl createAfterSuccessContext() { return new AfterSuccessContextImpl( - this.sdkConfiguration, - this.baseUrl, - "ListWebhooks", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "ListWebhooks", java.util.Optional.empty(), securitySource()); } AfterErrorContextImpl createAfterErrorContext() { return new AfterErrorContextImpl( - this.sdkConfiguration, - this.baseUrl, - "ListWebhooks", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "ListWebhooks", java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { - String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/webhooks", - request, this.operationGlobals); + + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = + Utils.generateURL(klass, this.baseUrl, "/{api_version}/webhooks", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); - req.addQueryParams(Utils.getQueryParams( - klass, - request, - this.operationGlobals)); + req.addQueryParams(Utils.getQueryParams(klass, request, this.operationGlobals)); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); return req.build(); } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(ListWebhooksRequest request) throws Exception { @@ -165,11 +141,11 @@ private HttpRequest onBuildRequest(ListWebhooksRequest request) throws Exception return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -202,49 +178,46 @@ public HttpResponse doRequest(ListWebhooksRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public ListWebhooksResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - ListWebhooksResponse.Builder resBuilder = - ListWebhooksResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + ListWebhooksResponse.Builder resBuilder = ListWebhooksResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); ListWebhooksResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - return res.withWebhookListResponse(Utils.unmarshal(response, new TypeReference() {})); + return res.withWebhookListResponse( + Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base implements AsyncRequestOperation { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -260,7 +233,8 @@ private CompletableFuture onBuildRequest(ListWebhooksRequest reques return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -275,51 +249,51 @@ public CompletableFuture> doRequest(ListWebhooksReques .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.ListWebhooksResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.ListWebhooksResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.ListWebhooksResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.ListWebhooksResponse - .builder() + com.google.genai.gaos.models.operations.async.ListWebhooksResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.ListWebhooksResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - return res.withWebhookListResponse(Utils.unmarshal(response, new TypeReference() {})); + return res.withWebhookListResponse( + Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/Operations.java b/src/main/java/com/google/genai/gaos/operations/Operations.java index 3d3e2c7991a..840e74bb92f 100644 --- a/src/main/java/com/google/genai/gaos/operations/Operations.java +++ b/src/main/java/com/google/genai/gaos/operations/Operations.java @@ -19,8 +19,8 @@ */ package com.google.genai.gaos.operations; -import java.io.InputStream; import com.google.genai.gaos.utils.transport.HttpResponse; +import java.io.InputStream; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; @@ -33,66 +33,65 @@ public class Operations { /** - * Base interface for all operations - */ + * Base interface for all operations + */ public interface Operation { ResT handleResponse(HttpResponse response); } /** - * Interface for operations that require a request parameter - */ + * Interface for operations that require a request parameter + */ public interface RequestOperation extends Operation { HttpResponse doRequest(ReqT request); } /** - * Interface for operations that don't require a request parameter - */ + * Interface for operations that don't require a request parameter + */ public interface RequestlessOperation extends Operation { HttpResponse doRequest(); } /** - * Base interface for all async operations - */ + * Base interface for all async operations + */ public interface AsyncOperation { ResT handleResponse(HttpResponse response); /** - * Returns the operation's cancellation relay, or {@code null} if unsupported. - */ + * Returns the operation's cancellation relay, or {@code null} if unsupported. + */ default CancellationRelay cancellationRelay() { return null; } } /** - * Interface for async operations that require a request parameter - */ + * Interface for async operations that require a request parameter + */ public interface AsyncRequestOperation extends AsyncOperation { CompletableFuture> doRequest(ReqT request); } /** - * Interface for async operations that don't require a request parameter - */ + * Interface for async operations that don't require a request parameter + */ public interface AsyncRequestlessOperation extends AsyncOperation { CompletableFuture> doRequest(); } /** - * Relays cancellation of the future returned to the SDK user to the - * in-flight HTTP call, releasing its connection. - */ + * Relays cancellation of the future returned to the SDK user to the + * in-flight HTTP call, releasing its connection. + */ public static final class CancellationRelay { - private final AtomicReference>> current = - new AtomicReference<>(); + private final AtomicReference>> current = new AtomicReference<>(); private volatile boolean cancelled; /** - * Registers the transport-stage future of the current attempt. - */ + * Registers the transport-stage future of the current attempt. + */ public CompletableFuture> track( CompletableFuture> transportFuture) { current.set(transportFuture); @@ -124,10 +123,9 @@ private static void cancelTransport(CompletableFuture> } /** - * Makes cancelling {@code future} cancel the operation's in-flight HTTP call. - */ - public static CompletableFuture relayCancel( - CompletableFuture future, AsyncOperation operation) { + * Makes cancelling {@code future} cancel the operation's in-flight HTTP call. + */ + public static CompletableFuture relayCancel(CompletableFuture future, AsyncOperation operation) { CancellationRelay relay = operation.cancellationRelay(); if (relay != null) { future.whenComplete((result, error) -> { @@ -140,25 +138,25 @@ public static CompletableFuture relayCancel( } private static final AtomicLong STREAM_COMPLETION_THREAD_COUNT = new AtomicLong(); - private static final ExecutorService STREAM_COMPLETION_EXECUTOR = Executors.newCachedThreadPool( - runnable -> { - Thread thread = new Thread(runnable, - "speakeasy-async-stream-completion-" + STREAM_COMPLETION_THREAD_COUNT.incrementAndGet()); - thread.setDaemon(true); - return thread; - }); + private static final ExecutorService STREAM_COMPLETION_EXECUTOR = Executors.newCachedThreadPool(runnable -> { + Thread thread = new Thread( + runnable, "speakeasy-async-stream-completion-" + + STREAM_COMPLETION_THREAD_COUNT.incrementAndGet()); + thread.setDaemon(true); + return thread; + }); public static Executor streamCompletionExecutor() { return STREAM_COMPLETION_EXECUTOR; } /** - * Runs blocking response-body reading and parsing away from the thread that - * completed the transport future. - */ + * Runs blocking response-body reading and parsing away from the thread that + * completed the transport future. + */ public static CompletableFuture applyBodyReadAsync( CompletableFuture> transportFuture, Function, T> handler) { return transportFuture.thenApplyAsync(handler, STREAM_COMPLETION_EXECUTOR); } -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/operations/PingWebhook.java b/src/main/java/com/google/genai/gaos/operations/PingWebhook.java index ec7acdc43b7..d758473f9cf 100644 --- a/src/main/java/com/google/genai/gaos/operations/PingWebhook.java +++ b/src/main/java/com/google/genai/gaos/operations/PingWebhook.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.PingWebhookRequest; import com.google.genai.gaos.models.operations.PingWebhookResponse; import com.google.genai.gaos.models.webhooks.WebhookPingResponse; @@ -45,8 +45,8 @@ import com.google.genai.gaos.utils.Retries; import com.google.genai.gaos.utils.RetryConfig; import com.google.genai.gaos.utils.SerializedBody; -import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils; +import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.transport.HttpRequest; import com.google.genai.gaos.utils.transport.HttpResponse; import jakarta.annotation.Nonnull; @@ -63,10 +63,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class PingWebhook { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -76,30 +75,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -108,49 +107,27 @@ Optional securitySource() { BeforeRequestContextImpl createBeforeRequestContext() { return new BeforeRequestContextImpl( - this.sdkConfiguration, - this.baseUrl, - "PingWebhook", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "PingWebhook", java.util.Optional.empty(), securitySource()); } AfterSuccessContextImpl createAfterSuccessContext() { return new AfterSuccessContextImpl( - this.sdkConfiguration, - this.baseUrl, - "PingWebhook", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "PingWebhook", java.util.Optional.empty(), securitySource()); } AfterErrorContextImpl createAfterErrorContext() { return new AfterErrorContextImpl( - this.sdkConfiguration, - this.baseUrl, - "PingWebhook", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "PingWebhook", java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/webhooks/{id}:ping", - request, this.operationGlobals); + klass, this.baseUrl, "/{api_version}/webhooks/{id}:ping", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - typeReference); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "body", - "json", - false); + Object convertedRequest = Utils.convertToShape(request, JsonShape.DEFAULT, typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody(convertedRequest, "body", "json", false); req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -158,26 +135,22 @@ HttpRequest buildRequest(T request, Class klass, TypeReference typeR } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(PingWebhookRequest request) throws Exception { - HttpRequest req = buildRequest(request, PingWebhookRequest.class, new TypeReference() {}); + HttpRequest req = + buildRequest(request, PingWebhookRequest.class, new TypeReference() {}); return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -210,49 +183,46 @@ public HttpResponse doRequest(PingWebhookRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public PingWebhookResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - PingWebhookResponse.Builder resBuilder = - PingWebhookResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + PingWebhookResponse.Builder resBuilder = PingWebhookResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); PingWebhookResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - return res.withWebhookPingResponse(Utils.unmarshal(response, new TypeReference() {})); + return res.withWebhookPingResponse( + Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base implements AsyncRequestOperation { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -264,11 +234,13 @@ public Operations.CancellationRelay cancellationRelay() { } private CompletableFuture onBuildRequest(PingWebhookRequest request) throws Exception { - HttpRequest req = buildRequest(request, PingWebhookRequest.class, new TypeReference() {}); + HttpRequest req = + buildRequest(request, PingWebhookRequest.class, new TypeReference() {}); return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -283,51 +255,51 @@ public CompletableFuture> doRequest(PingWebhookRequest .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.PingWebhookResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.PingWebhookResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.PingWebhookResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.PingWebhookResponse - .builder() + com.google.genai.gaos.models.operations.async.PingWebhookResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.PingWebhookResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - return res.withWebhookPingResponse(Utils.unmarshal(response, new TypeReference() {})); + return res.withWebhookPingResponse( + Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/RotateSigningSecret.java b/src/main/java/com/google/genai/gaos/operations/RotateSigningSecret.java index 22837a0e4ea..7f1c491f9c7 100644 --- a/src/main/java/com/google/genai/gaos/operations/RotateSigningSecret.java +++ b/src/main/java/com/google/genai/gaos/operations/RotateSigningSecret.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.RotateSigningSecretRequest; import com.google.genai.gaos.models.operations.RotateSigningSecretResponse; import com.google.genai.gaos.models.webhooks.WebhookRotateSigningSecretResponse; @@ -45,8 +45,8 @@ import com.google.genai.gaos.utils.Retries; import com.google.genai.gaos.utils.RetryConfig; import com.google.genai.gaos.utils.SerializedBody; -import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils; +import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.transport.HttpRequest; import com.google.genai.gaos.utils.transport.HttpResponse; import jakarta.annotation.Nonnull; @@ -63,10 +63,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class RotateSigningSecret { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -76,30 +75,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -132,25 +131,19 @@ AfterErrorContextImpl createAfterErrorContext() { java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { String url = Utils.generateURL( klass, this.baseUrl, "/{api_version}/webhooks/{id}:rotateSigningSecret", - request, this.operationGlobals); - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( request, - JsonShape.DEFAULT, - typeReference); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "body", - "json", - false); + this.operationGlobals); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape(request, JsonShape.DEFAULT, typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody(convertedRequest, "body", "json", false); req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -160,24 +153,21 @@ HttpRequest buildRequest(T request, Class klass, TypeReference typeR public static class Sync extends Base implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(RotateSigningSecretRequest request) throws Exception { - HttpRequest req = buildRequest(request, RotateSigningSecretRequest.class, new TypeReference() {}); + HttpRequest req = buildRequest( + request, RotateSigningSecretRequest.class, new TypeReference() {}); return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -210,49 +200,47 @@ public HttpResponse doRequest(RotateSigningSecretRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public RotateSigningSecretResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - RotateSigningSecretResponse.Builder resBuilder = - RotateSigningSecretResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + RotateSigningSecretResponse.Builder resBuilder = RotateSigningSecretResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); RotateSigningSecretResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - return res.withWebhookRotateSigningSecretResponse(Utils.unmarshal(response, new TypeReference() {})); + return res.withWebhookRotateSigningSecretResponse( + Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base - implements AsyncRequestOperation { + implements AsyncRequestOperation< + RotateSigningSecretRequest, com.google.genai.gaos.models.operations.async.RotateSigningSecretResponse> { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -264,11 +252,13 @@ public Operations.CancellationRelay cancellationRelay() { } private CompletableFuture onBuildRequest(RotateSigningSecretRequest request) throws Exception { - HttpRequest req = buildRequest(request, RotateSigningSecretRequest.class, new TypeReference() {}); + HttpRequest req = buildRequest( + request, RotateSigningSecretRequest.class, new TypeReference() {}); return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -283,51 +273,51 @@ public CompletableFuture> doRequest(RotateSigningSecre .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.RotateSigningSecretResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.RotateSigningSecretResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.RotateSigningSecretResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.RotateSigningSecretResponse - .builder() + com.google.genai.gaos.models.operations.async.RotateSigningSecretResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.RotateSigningSecretResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - return res.withWebhookRotateSigningSecretResponse(Utils.unmarshal(response, new TypeReference() {})); + return res.withWebhookRotateSigningSecretResponse( + Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/RunTrigger.java b/src/main/java/com/google/genai/gaos/operations/RunTrigger.java index 498891a4bfc..a14696feb25 100644 --- a/src/main/java/com/google/genai/gaos/operations/RunTrigger.java +++ b/src/main/java/com/google/genai/gaos/operations/RunTrigger.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.RunTriggerRequest; import com.google.genai.gaos.models.operations.RunTriggerResponse; import com.google.genai.gaos.models.triggers.TriggerExecution; @@ -60,10 +60,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class RunTrigger { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -73,30 +72,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -105,39 +104,28 @@ Optional securitySource() { BeforeRequestContextImpl createBeforeRequestContext() { return new BeforeRequestContextImpl( - this.sdkConfiguration, - this.baseUrl, - "RunTrigger", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "RunTrigger", java.util.Optional.empty(), securitySource()); } AfterSuccessContextImpl createAfterSuccessContext() { return new AfterSuccessContextImpl( - this.sdkConfiguration, - this.baseUrl, - "RunTrigger", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "RunTrigger", java.util.Optional.empty(), securitySource()); } AfterErrorContextImpl createAfterErrorContext() { return new AfterErrorContextImpl( - this.sdkConfiguration, - this.baseUrl, - "RunTrigger", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "RunTrigger", java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass) throws Exception { + + HttpRequest buildRequest(T request, Class klass) throws Exception { String url = Utils.generateURL( klass, this.baseUrl, "/{api_version}/triggers/{trigger_id}/executions", - request, this.operationGlobals); + request, + this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "POST"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -145,14 +133,9 @@ HttpRequest buildRequest(T request, Class klass) throws Exception { } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(RunTriggerRequest request) throws Exception { @@ -160,11 +143,11 @@ private HttpRequest onBuildRequest(RunTriggerRequest request) throws Exception { return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -197,49 +180,46 @@ public HttpResponse doRequest(RunTriggerRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public RunTriggerResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - RunTriggerResponse.Builder resBuilder = - RunTriggerResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + RunTriggerResponse.Builder resBuilder = RunTriggerResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); RunTriggerResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - return res.withTriggerExecution(Utils.unmarshal(response, new TypeReference() {})); + return res.withTriggerExecution( + Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base implements AsyncRequestOperation { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -255,7 +235,8 @@ private CompletableFuture onBuildRequest(RunTriggerRequest request) return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -270,51 +251,51 @@ public CompletableFuture> doRequest(RunTriggerRequest .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.RunTriggerResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.RunTriggerResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.RunTriggerResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.RunTriggerResponse - .builder() + com.google.genai.gaos.models.operations.async.RunTriggerResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.RunTriggerResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - return res.withTriggerExecution(Utils.unmarshal(response, new TypeReference() {})); + return res.withTriggerExecution( + Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/UpdateTrigger.java b/src/main/java/com/google/genai/gaos/operations/UpdateTrigger.java index 09a8ef0b7a2..d60f36a9976 100644 --- a/src/main/java/com/google/genai/gaos/operations/UpdateTrigger.java +++ b/src/main/java/com/google/genai/gaos/operations/UpdateTrigger.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.UpdateTriggerRequest; import com.google.genai.gaos.models.operations.UpdateTriggerResponse; import com.google.genai.gaos.models.triggers.Trigger; @@ -45,8 +45,8 @@ import com.google.genai.gaos.utils.Retries; import com.google.genai.gaos.utils.RetryConfig; import com.google.genai.gaos.utils.SerializedBody; -import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils; +import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.transport.HttpRequest; import com.google.genai.gaos.utils.transport.HttpResponse; import jakarta.annotation.Nonnull; @@ -64,10 +64,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class UpdateTrigger { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -77,30 +76,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -109,52 +108,30 @@ Optional securitySource() { BeforeRequestContextImpl createBeforeRequestContext() { return new BeforeRequestContextImpl( - this.sdkConfiguration, - this.baseUrl, - "UpdateTrigger", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "UpdateTrigger", java.util.Optional.empty(), securitySource()); } AfterSuccessContextImpl createAfterSuccessContext() { return new AfterSuccessContextImpl( - this.sdkConfiguration, - this.baseUrl, - "UpdateTrigger", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "UpdateTrigger", java.util.Optional.empty(), securitySource()); } AfterErrorContextImpl createAfterErrorContext() { return new AfterErrorContextImpl( - this.sdkConfiguration, - this.baseUrl, - "UpdateTrigger", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "UpdateTrigger", java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/triggers/{id}", - request, this.operationGlobals); + klass, this.baseUrl, "/{api_version}/triggers/{id}", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "PATCH"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - typeReference); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "body", - "json", - false); + Object convertedRequest = Utils.convertToShape(request, JsonShape.DEFAULT, typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody(convertedRequest, "body", "json", false); if (serializedRequestBody == null) { throw new IllegalArgumentException("Request body is required"); } req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); @@ -162,26 +139,22 @@ HttpRequest buildRequest(T request, Class klass, TypeReference typeR } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(UpdateTriggerRequest request) throws Exception { - HttpRequest req = buildRequest(request, UpdateTriggerRequest.class, new TypeReference() {}); + HttpRequest req = + buildRequest(request, UpdateTriggerRequest.class, new TypeReference() {}); return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -214,49 +187,46 @@ public HttpResponse doRequest(UpdateTriggerRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public UpdateTriggerResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - UpdateTriggerResponse.Builder resBuilder = - UpdateTriggerResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + UpdateTriggerResponse.Builder resBuilder = UpdateTriggerResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); UpdateTriggerResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withTrigger(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base - implements AsyncRequestOperation { + implements AsyncRequestOperation< + UpdateTriggerRequest, com.google.genai.gaos.models.operations.async.UpdateTriggerResponse> { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -268,11 +238,13 @@ public Operations.CancellationRelay cancellationRelay() { } private CompletableFuture onBuildRequest(UpdateTriggerRequest request) throws Exception { - HttpRequest req = buildRequest(request, UpdateTriggerRequest.class, new TypeReference() {}); + HttpRequest req = + buildRequest(request, UpdateTriggerRequest.class, new TypeReference() {}); return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -287,51 +259,50 @@ public CompletableFuture> doRequest(UpdateTriggerReque .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.UpdateTriggerResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.UpdateTriggerResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.UpdateTriggerResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.UpdateTriggerResponse - .builder() + com.google.genai.gaos.models.operations.async.UpdateTriggerResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.UpdateTriggerResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withTrigger(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/operations/UpdateWebhook.java b/src/main/java/com/google/genai/gaos/operations/UpdateWebhook.java index 452fd28f406..ef6c0daee32 100644 --- a/src/main/java/com/google/genai/gaos/operations/UpdateWebhook.java +++ b/src/main/java/com/google/genai/gaos/operations/UpdateWebhook.java @@ -19,14 +19,14 @@ */ package com.google.genai.gaos.operations; +import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import static com.google.genai.gaos.operations.Operations.RequestOperation; import static com.google.genai.gaos.utils.Exceptions.unchecked; -import static com.google.genai.gaos.operations.Operations.AsyncRequestOperation; import com.fasterxml.jackson.core.type.TypeReference; import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.SecuritySource; -import com.google.genai.gaos.models.errors.SDKException; +import com.google.genai.gaos.models.errors.GaosApiException; import com.google.genai.gaos.models.operations.UpdateWebhookRequest; import com.google.genai.gaos.models.operations.UpdateWebhookResponse; import com.google.genai.gaos.models.webhooks.Webhook; @@ -45,8 +45,8 @@ import com.google.genai.gaos.utils.Retries; import com.google.genai.gaos.utils.RetryConfig; import com.google.genai.gaos.utils.SerializedBody; -import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.Utils; +import com.google.genai.gaos.utils.Utils.JsonShape; import com.google.genai.gaos.utils.transport.HttpRequest; import com.google.genai.gaos.utils.transport.HttpResponse; import jakarta.annotation.Nonnull; @@ -63,10 +63,9 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; - public class UpdateWebhook { - static abstract class Base { + abstract static class Base { final SDKConfiguration sdkConfiguration; final String baseUrl; final SecuritySource securitySource; @@ -76,30 +75,30 @@ static abstract class Base { final Headers _headers; final Globals operationGlobals; - public Base( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { + public Base(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { this.sdkConfiguration = sdkConfiguration; - this._headers =_headers; + this._headers = _headers; this.baseUrl = this.sdkConfiguration.serverUrl(); this.securitySource = this.sdkConfiguration.securitySource(); - Optional.ofNullable(options) - .ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); + Optional.ofNullable(options).ifPresent(o -> o.validate(Java8Compat.listOf(Options.Option.RETRY_CONFIG))); this.retryStatusCodes = Java8Compat.listOf("408", "409", "429", "5XX"); - this.retryConfig = Java8Compat.or(Optional.ofNullable(options) - .flatMap(Options::retryConfig), sdkConfiguration::retryConfig) - .orElse(RetryConfig.builder().attemptCountBackoff(4, BackoffStrategy.builder() - .initialInterval(500, TimeUnit.MILLISECONDS) - .maxInterval(8000, TimeUnit.MILLISECONDS) - .baseFactor((double) (2)) - .maxElapsedTime(30000, TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) + this.retryConfig = Java8Compat.or(Optional.ofNullable(options).flatMap(Options::retryConfig), sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder() + .attemptCountBackoff( + 4, + BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(8000, TimeUnit.MILLISECONDS) + .baseFactor((double) (2)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) .build()); this.client = this.sdkConfiguration.client(); this.operationGlobals = new Globals(); - this.sdkConfiguration.globals.getParam("pathParam", "api_version") - .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); + this.sdkConfiguration.globals + .getParam("pathParam", "api_version") + .ifPresent(param -> operationGlobals.putParam("pathParam", "api_version", param)); } Optional securitySource() { @@ -108,81 +107,52 @@ Optional securitySource() { BeforeRequestContextImpl createBeforeRequestContext() { return new BeforeRequestContextImpl( - this.sdkConfiguration, - this.baseUrl, - "UpdateWebhook", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "UpdateWebhook", java.util.Optional.empty(), securitySource()); } AfterSuccessContextImpl createAfterSuccessContext() { return new AfterSuccessContextImpl( - this.sdkConfiguration, - this.baseUrl, - "UpdateWebhook", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "UpdateWebhook", java.util.Optional.empty(), securitySource()); } AfterErrorContextImpl createAfterErrorContext() { return new AfterErrorContextImpl( - this.sdkConfiguration, - this.baseUrl, - "UpdateWebhook", - java.util.Optional.empty(), - securitySource()); + this.sdkConfiguration, this.baseUrl, "UpdateWebhook", java.util.Optional.empty(), securitySource()); } - HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { String url = Utils.generateURL( - klass, - this.baseUrl, - "/{api_version}/webhooks/{id}", - request, this.operationGlobals); + klass, this.baseUrl, "/{api_version}/webhooks/{id}", request, this.operationGlobals); HTTPRequest req = new HTTPRequest(url, "PATCH"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - typeReference); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "body", - "json", - false); + Object convertedRequest = Utils.convertToShape(request, JsonShape.DEFAULT, typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody(convertedRequest, "body", "json", false); req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", SDKConfiguration.USER_AGENT); + req.addHeader("Accept", "application/json").addHeader("user-agent", SDKConfiguration.USER_AGENT); _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); - req.addQueryParams(Utils.getQueryParams( - klass, - request, - this.operationGlobals)); + req.addQueryParams(Utils.getQueryParams(klass, request, this.operationGlobals)); Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); return req.build(); } } - public static class Sync extends Base - implements RequestOperation { - public Sync( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - Headers _headers) { - super( - sdkConfiguration, options, - _headers); + public static class Sync extends Base implements RequestOperation { + public Sync(@Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, Headers _headers) { + super(sdkConfiguration, options, _headers); } private HttpRequest onBuildRequest(UpdateWebhookRequest request) throws Exception { - HttpRequest req = buildRequest(request, UpdateWebhookRequest.class, new TypeReference() {}); + HttpRequest req = + buildRequest(request, UpdateWebhookRequest.class, new TypeReference() {}); return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); } - private HttpResponse onError(HttpResponse response, Exception error) throws Exception { - return sdkConfiguration.hooks().afterError( - createAfterErrorContext(), - Optional.ofNullable(response), - Optional.ofNullable(error)); + private HttpResponse onError(HttpResponse response, Exception error) + throws Exception { + return sdkConfiguration + .hooks() + .afterError(createAfterErrorContext(), Optional.ofNullable(response), Optional.ofNullable(error)); } private HttpResponse onSuccess(HttpResponse response) throws Exception { @@ -215,49 +185,46 @@ public HttpResponse doRequest(UpdateWebhookRequest request) { return unchecked(() -> onSuccess(retries.run())).get(); } - @Override public UpdateWebhookResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); - UpdateWebhookResponse.Builder resBuilder = - UpdateWebhookResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); + String contentType = response.contentType().orElse("application/octet-stream"); + UpdateWebhookResponse.Builder resBuilder = UpdateWebhookResponse.builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); UpdateWebhookResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withWebhook(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } + public static class Async extends Base - implements AsyncRequestOperation { + implements AsyncRequestOperation< + UpdateWebhookRequest, com.google.genai.gaos.models.operations.async.UpdateWebhookResponse> { private final ScheduledExecutorService retryScheduler; public Async( - @Nonnull SDKConfiguration sdkConfiguration, @Nullable Options options, - @Nullable ScheduledExecutorService retryScheduler, Headers _headers) { - super( - sdkConfiguration, options, - _headers); + @Nonnull SDKConfiguration sdkConfiguration, + @Nullable Options options, + @Nullable ScheduledExecutorService retryScheduler, + Headers _headers) { + super(sdkConfiguration, options, _headers); this.retryScheduler = retryScheduler; } @@ -269,11 +236,13 @@ public Operations.CancellationRelay cancellationRelay() { } private CompletableFuture onBuildRequest(UpdateWebhookRequest request) throws Exception { - HttpRequest req = buildRequest(request, UpdateWebhookRequest.class, new TypeReference() {}); + HttpRequest req = + buildRequest(request, UpdateWebhookRequest.class, new TypeReference() {}); return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); } - private CompletableFuture> onError(HttpResponse response, Throwable error) { + private CompletableFuture> onError( + HttpResponse response, Throwable error) { return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); } @@ -288,51 +257,50 @@ public CompletableFuture> doRequest(UpdateWebhookReque .statusCodes(retryStatusCodes) .scheduler(retryScheduler) .build(); - return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)).get() - .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) - .handle((resp, err) -> { - if (err != null) { - return onError(null, err); - } - if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { - return onError(resp, null); - } - return CompletableFuture.completedFuture(resp); - }) - .thenCompose(Function.identity())) + return retries.retry((attempt) -> unchecked(() -> onBuildRequest(request)) + .get() + .thenCompose(req -> cancellationRelay.track(client.sendAsync(req))) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) .thenCompose(this::onSuccess); } @Override - public com.google.genai.gaos.models.operations.async.UpdateWebhookResponse handleResponse(HttpResponse response) { - String contentType = response - .contentType() - .orElse("application/octet-stream"); + public com.google.genai.gaos.models.operations.async.UpdateWebhookResponse handleResponse( + HttpResponse response) { + String contentType = response.contentType().orElse("application/octet-stream"); com.google.genai.gaos.models.operations.async.UpdateWebhookResponse.Builder resBuilder = - com.google.genai.gaos.models.operations.async.UpdateWebhookResponse - .builder() + com.google.genai.gaos.models.operations.async.UpdateWebhookResponse.builder() .contentType(contentType) .statusCode(response.statusCode()) .rawResponse(response); com.google.genai.gaos.models.operations.async.UpdateWebhookResponse res = resBuilder.build(); - + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw SDKException.from("API error occurred", response); + throw GaosApiException.from("API error occurred", response); } if (Utils.statusCodeMatches(response.statusCode(), "default")) { if (Utils.contentTypeMatches(contentType, "application/json")) { return res.withWebhook(Utils.unmarshal(response, new TypeReference() {})); } else { - throw SDKException.from("Unexpected content-type received: " + contentType, response); + throw GaosApiException.from("Unexpected content-type received: " + contentType, response); } } - throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + throw GaosApiException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/google/genai/gaos/utils/AsyncHook.java b/src/main/java/com/google/genai/gaos/utils/AsyncHook.java index 404dbeba7e7..a59382067c4 100644 --- a/src/main/java/com/google/genai/gaos/utils/AsyncHook.java +++ b/src/main/java/com/google/genai/gaos/utils/AsyncHook.java @@ -19,13 +19,12 @@ */ package com.google.genai.gaos.utils; - import com.google.genai.gaos.utils.transport.HttpRequest; import com.google.genai.gaos.utils.transport.HttpResponse; import java.io.InputStream; -import java.util.concurrent.CompletableFuture; import java.util.Optional; import java.util.UUID; +import java.util.concurrent.CompletableFuture; /** * Utility class for defining async hook interfaces. @@ -70,9 +69,10 @@ public interface AfterSuccess { * @param response response to be transformed * @return transformed response */ - CompletableFuture> afterSuccess(Hook.AfterSuccessContext context, HttpResponse response); + CompletableFuture> afterSuccess( + Hook.AfterSuccessContext context, HttpResponse response); - AfterSuccess DEFAULT = (context, response) -> CompletableFuture.completedFuture(response); + AfterSuccess DEFAULT = (context, response) -> CompletableFuture.completedFuture(response); } /** @@ -93,13 +93,9 @@ public interface AfterError { * @return HTTP response if method decides that an exception is not to be thrown */ CompletableFuture> afterError( - Hook.AfterErrorContext context, - HttpResponse response, - Throwable error); + Hook.AfterErrorContext context, HttpResponse response, Throwable error); - AfterError DEFAULT = (context, response, error) -> Optional.ofNullable(response) - .map(CompletableFuture::completedFuture) - .orElse(Java8Compat.failedFuture(error)); + AfterError DEFAULT = (context, response, error) -> Optional.ofNullable(response).map(CompletableFuture::completedFuture).orElse(Java8Compat.failedFuture(error)); } public static final class IdempotencyHook implements BeforeRequest { diff --git a/src/main/java/com/google/genai/gaos/utils/AsyncHooks.java b/src/main/java/com/google/genai/gaos/utils/AsyncHooks.java index 056cd8d724a..8759393096e 100644 --- a/src/main/java/com/google/genai/gaos/utils/AsyncHooks.java +++ b/src/main/java/com/google/genai/gaos/utils/AsyncHooks.java @@ -19,14 +19,6 @@ */ package com.google.genai.gaos.utils; -import com.google.genai.gaos.utils.transport.HttpResponse; -import com.google.genai.gaos.utils.transport.HttpRequest; -import java.io.InputStream; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.atomic.AtomicBoolean; - import com.google.genai.gaos.utils.AsyncHook.AfterError; import com.google.genai.gaos.utils.AsyncHook.AfterSuccess; import com.google.genai.gaos.utils.AsyncHook.BeforeRequest; @@ -34,6 +26,13 @@ import com.google.genai.gaos.utils.Hook.AfterSuccessContext; import com.google.genai.gaos.utils.Hook.BeforeRequestContext; import com.google.genai.gaos.utils.Hooks.FailEarlyException; +import com.google.genai.gaos.utils.transport.HttpRequest; +import com.google.genai.gaos.utils.transport.HttpResponse; +import java.io.InputStream; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.atomic.AtomicBoolean; /** * Async hook registry for runtime request/response processing. @@ -57,8 +56,7 @@ public class AsyncHooks implements BeforeRequest, AfterSuccess, AfterError { private final List afterSuccessHooks = new CopyOnWriteArrayList<>(); private final List afterErrorHooks = new CopyOnWriteArrayList<>(); - public AsyncHooks() { - } + public AsyncHooks() {} /** * Registers an async before-request hook. Hooks are chained in registration order. @@ -69,7 +67,10 @@ public AsyncHooks() { public AsyncHooks registerBeforeRequest(BeforeRequest beforeRequest) { Utils.checkNotNull(beforeRequest, "beforeRequest"); this.beforeRequestHooks.add(beforeRequest); - logger.debug("Registered async BeforeRequest hook: {} (total: {})", beforeRequest.getClass().getSimpleName(), beforeRequestHooks.size()); + logger.debug( + "Registered async BeforeRequest hook: {} (total: {})", + beforeRequest.getClass().getSimpleName(), + beforeRequestHooks.size()); return this; } @@ -82,7 +83,10 @@ public AsyncHooks registerBeforeRequest(BeforeRequest beforeRequest) { public AsyncHooks registerAfterSuccess(AfterSuccess afterSuccess) { Utils.checkNotNull(afterSuccess, "afterSuccess"); this.afterSuccessHooks.add(afterSuccess); - logger.debug("Registered async AfterSuccess hook: {} (total: {})", afterSuccess.getClass().getSimpleName(), afterSuccessHooks.size()); + logger.debug( + "Registered async AfterSuccess hook: {} (total: {})", + afterSuccess.getClass().getSimpleName(), + afterSuccessHooks.size()); return this; } @@ -95,7 +99,10 @@ public AsyncHooks registerAfterSuccess(AfterSuccess afterSuccess) { public AsyncHooks registerAfterError(AfterError afterError) { Utils.checkNotNull(afterError, "afterError"); this.afterErrorHooks.add(afterError); - logger.debug("Registered async AfterError hook: {} (total: {})", afterError.getClass().getSimpleName(), afterErrorHooks.size()); + logger.debug( + "Registered async AfterError hook: {} (total: {})", + afterError.getClass().getSimpleName(), + afterErrorHooks.size()); return this; } @@ -105,7 +112,10 @@ public CompletableFuture beforeRequest(BeforeRequestContext context Utils.checkNotNull(request, "request"); if (logger.isTraceEnabled() && !beforeRequestHooks.isEmpty()) { - logger.trace("Executing {} async beforeRequest hook(s) for operation: {}", beforeRequestHooks.size(), context.operationId()); + logger.trace( + "Executing {} async beforeRequest hook(s) for operation: {}", + beforeRequestHooks.size(), + context.operationId()); } CompletableFuture result = CompletableFuture.completedFuture(request); @@ -119,28 +129,27 @@ public CompletableFuture beforeRequest(BeforeRequestContext context @Override public CompletableFuture> afterSuccess( - AfterSuccessContext context, - HttpResponse response) { + AfterSuccessContext context, HttpResponse response) { Utils.checkNotNull(context, "context"); Utils.checkNotNull(response, "response"); if (logger.isTraceEnabled() && !afterSuccessHooks.isEmpty()) { - logger.trace("Executing {} async afterSuccess hook(s) for operation: {}", afterSuccessHooks.size(), context.operationId()); + logger.trace( + "Executing {} async afterSuccess hook(s) for operation: {}", + afterSuccessHooks.size(), + context.operationId()); } CompletableFuture> result = CompletableFuture.completedFuture(response); for (AfterSuccess hook : afterSuccessHooks) { - result = result.handle((resp, ex) -> - hook.afterSuccess(context, resp) - .thenApply(hookResp -> { - if (hookResp == null) { - throw new IllegalStateException( - "afterSuccess must return a non-null response"); - } - return hookResp; - }) - ).thenCompose(future -> future); + result = result.handle((resp, ex) -> hook.afterSuccess(context, resp).thenApply(hookResp -> { + if (hookResp == null) { + throw new IllegalStateException("afterSuccess must return a non-null response"); + } + return hookResp; + })) + .thenCompose(future -> future); } return result; @@ -148,16 +157,16 @@ public CompletableFuture> afterSuccess( @Override public CompletableFuture> afterError( - AfterErrorContext context, - HttpResponse response, - Throwable error) { + AfterErrorContext context, HttpResponse response, Throwable error) { Utils.checkNotNull(context, "context"); Utils.checkArgument( - (response != null) ^ (error != null), - "one and only one of response or error must be present"); + (response != null) ^ (error != null), "one and only one of response or error must be present"); if (logger.isTraceEnabled() && !afterErrorHooks.isEmpty()) { - logger.trace("Executing {} async afterError hook(s) for operation: {}", afterErrorHooks.size(), context.operationId()); + logger.trace( + "Executing {} async afterError hook(s) for operation: {}", + afterErrorHooks.size(), + context.operationId()); } CompletableFuture> result; @@ -170,31 +179,30 @@ public CompletableFuture> afterError( AtomicBoolean failedEarly = new AtomicBoolean(false); for (AfterError hook : afterErrorHooks) { result = result.handle((resp, ex) -> { - if (failedEarly.get()) { - throw (FailEarlyException) ex; + if (failedEarly.get()) { + throw (FailEarlyException) ex; + } + return hook.afterError(context, resp, ex).handle((hookResp, hookErr) -> { + if (hookErr != null) { + if (hookErr instanceof FailEarlyException) { + failedEarly.set(true); + throw (FailEarlyException) hookErr; } - return hook.afterError(context, resp, ex) - .handle((hookResp, hookErr) -> { - if (hookErr != null) { - if (hookErr instanceof FailEarlyException) { - failedEarly.set(true); - throw (FailEarlyException) hookErr; - } - logger.debug("Async hook threw exception: {}", hookErr.getClass().getSimpleName()); - throw Exceptions.unchecked(hookErr); - } - if (hookResp == null) { - throw new IllegalStateException( - "afterError must either throw an exception or return a non-null response"); - } - - return hookResp; - }); + logger.debug( + "Async hook threw exception: {}", + hookErr.getClass().getSimpleName()); + throw Exceptions.unchecked(hookErr); + } + if (hookResp == null) { + throw new IllegalStateException( + "afterError must either throw an exception or return a non-null response"); } - ).thenCompose(future -> future); + + return hookResp; + }); + }).thenCompose(future -> future); } return result; } - } diff --git a/src/main/java/com/google/genai/gaos/utils/AsyncResponse.java b/src/main/java/com/google/genai/gaos/utils/AsyncResponse.java index bcba574bd23..82bd723a187 100644 --- a/src/main/java/com/google/genai/gaos/utils/AsyncResponse.java +++ b/src/main/java/com/google/genai/gaos/utils/AsyncResponse.java @@ -18,23 +18,24 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ package com.google.genai.gaos.utils; -import java.io.InputStream; + import com.google.genai.gaos.utils.transport.HttpResponse; +import java.io.InputStream; public interface AsyncResponse { - + /** * Returns the value of the Content-Type header. **/ String contentType(); - - /** + + /** * Returns the HTTP status code. **/ int statusCode(); - + /** * Returns the raw response. **/ HttpResponse rawResponse(); -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/utils/AsyncRetries.java b/src/main/java/com/google/genai/gaos/utils/AsyncRetries.java index 5d80dd8927d..c015c231fcc 100644 --- a/src/main/java/com/google/genai/gaos/utils/AsyncRetries.java +++ b/src/main/java/com/google/genai/gaos/utils/AsyncRetries.java @@ -19,11 +19,12 @@ */ package com.google.genai.gaos.utils; +import com.google.genai.gaos.utils.transport.HttpResponse; import java.io.IOException; +import java.io.InputStream; import java.io.InterruptedIOException; import java.net.ConnectException; import java.net.SocketTimeoutException; -import com.google.genai.gaos.utils.transport.HttpResponse; import java.time.Duration; import java.time.Instant; import java.time.ZonedDateTime; @@ -31,7 +32,6 @@ import java.util.List; import java.util.concurrent.*; import java.util.function.Supplier; -import java.io.InputStream; public class AsyncRetries { @@ -46,9 +46,8 @@ public interface RetryTask { CompletableFuture> get(int attempt); } - private AsyncRetries(RetryConfig retryConfig, - List retriableStatusCodes, - ScheduledExecutorService scheduler) { + private AsyncRetries( + RetryConfig retryConfig, List retriableStatusCodes, ScheduledExecutorService scheduler) { Utils.checkNotNull(retryConfig, "retryConfig"); Utils.checkNotNull(retriableStatusCodes, "statusCodes"); if (retriableStatusCodes.isEmpty()) { @@ -59,21 +58,19 @@ private AsyncRetries(RetryConfig retryConfig, this.scheduler = scheduler; } - public CompletableFuture> retry( - RetryTask task - ) { + public CompletableFuture> retry(RetryTask task) { switch (retryConfig.strategy()) { case BACKOFF: CompletableFuture> future = new CompletableFuture<>(); - BackoffStrategy backoff = retryConfig.backoff() - // We want to fail fast during misconfigurations. + BackoffStrategy backoff = retryConfig + .backoff() .orElseThrow(() -> new IllegalArgumentException("Backoff strategy is not defined")); attempt(task, future, backoff, new State(0, Instant.now())); return future; case ATTEMPT_COUNT_BACKOFF: future = new CompletableFuture<>(); - backoff = retryConfig.backoff() - // We want to fail fast during misconfigurations. + backoff = retryConfig + .backoff() .orElseThrow(() -> new IllegalArgumentException("Backoff strategy is not defined")); attempt(task, future, backoff, new State(0, Instant.now())); return future; @@ -85,15 +82,12 @@ public CompletableFuture> retry( } public CompletableFuture> retry( - Supplier>> task - ) { + Supplier>> task) { return retry((attempt) -> task.get()); } - private void attempt(RetryTask task, - CompletableFuture> result, - BackoffStrategy backoff, - State state) { + private void attempt( + RetryTask task, CompletableFuture> result, BackoffStrategy backoff, State state) { if (state.count() > 0) { logger.debug("Async retry attempt {} after backoff", state.count()); } @@ -118,11 +112,12 @@ private void attempt(RetryTask task, }); } - private void handleThrowable(RetryTask task, - CompletableFuture> result, - BackoffStrategy backoff, - State state, - Throwable throwable) { + private void handleThrowable( + RetryTask task, + CompletableFuture> result, + BackoffStrategy backoff, + State state, + Throwable throwable) { Throwable e = (throwable instanceof CompletionException && throwable.getCause() != null) ? throwable.getCause() : throwable; @@ -172,8 +167,7 @@ private long retryAfterMs(HttpResponse response) { try { long milliseconds = Long.parseLong(retryAfterMs); return milliseconds < 0 ? 0 : milliseconds; - } catch (NumberFormatException ignored) { - } + } catch (NumberFormatException ignored) {} } String retryAfter = response.headers().firstValue("retry-after").orElse(null); @@ -183,22 +177,21 @@ private long retryAfterMs(HttpResponse response) { try { long seconds = Long.parseLong(retryAfter); return seconds < 0 ? 0 : seconds * 1000; - } catch (NumberFormatException ignored) { - } + } catch (NumberFormatException ignored) {} try { ZonedDateTime retryDate = ZonedDateTime.parse(retryAfter, DateTimeFormatter.RFC_1123_DATE_TIME); long deltaMs = retryDate.toInstant().toEpochMilli() - System.currentTimeMillis(); return deltaMs > 0 ? deltaMs : 0; - } catch (Exception ignored) { - } + } catch (Exception ignored) {} return 0; } - private void maybeRetry(RetryTask task, - CompletableFuture> result, - BackoffStrategy backoff, - State state, - Throwable e) { + private void maybeRetry( + RetryTask task, + CompletableFuture> result, + BackoffStrategy backoff, + State state, + Throwable e) { Duration timeSinceStart = Duration.between(state.startedAt(), Instant.now()); if (retryConfig.strategy() == RetryConfig.Strategy.ATTEMPT_COUNT_BACKOFF && state.count() >= retryConfig.maxRetries().orElse(0)) { @@ -213,7 +206,8 @@ private void maybeRetry(RetryTask task, if (retryConfig.strategy() == RetryConfig.Strategy.BACKOFF && timeSinceStart.toMillis() > backoff.maxElapsedTimeMs()) { // retry exhausted - logger.debug("Async retry exhausted after {}ms, {} attempts", timeSinceStart.toMillis(), state.count() + 1); + logger.debug( + "Async retry exhausted after {}ms, {} attempts", timeSinceStart.toMillis(), state.count() + 1); if (e instanceof AsyncRetryableException) { result.complete(((AsyncRetryableException) e).response()); return; @@ -243,9 +237,11 @@ private void maybeRetry(RetryTask task, if (logger.isTraceEnabled()) { String reason = e instanceof AsyncRetryableException - ? "status " + ((AsyncRetryableException) e).response().statusCode() - : e.getClass().getSimpleName(); - logger.trace("Async retrying due to {} - waiting {}ms before attempt {}", reason, intervalMs, state.count() + 1); + ? "status " + + ((AsyncRetryableException) e).response().statusCode() + : e.getClass().getSimpleName(); + logger.trace( + "Async retrying due to {} - waiting {}ms before attempt {}", reason, intervalMs, state.count() + 1); } if (e instanceof AsyncRetryableException) { @@ -259,9 +255,7 @@ private void maybeRetry(RetryTask task, try { scheduler.schedule( - () -> attempt(task, result, backoff, state.countAttempt()), - intervalMs, - TimeUnit.MILLISECONDS); + () -> attempt(task, result, backoff, state.countAttempt()), intervalMs, TimeUnit.MILLISECONDS); } catch (RejectedExecutionException exception) { result.completeExceptionally(exception); } @@ -273,8 +267,7 @@ private static void closeQuietly(HttpResponse response) { if (body != null) { body.close(); } - } catch (IOException ignored) { - } + } catch (IOException ignored) {} } public void shutdown() { @@ -285,14 +278,13 @@ public static Builder builder() { return new Builder(); } - public final static class Builder { + public static final class Builder { private RetryConfig retryConfig; private List statusCodes; private ScheduledExecutorService scheduler; - private Builder() { - } + private Builder() {} /** * Defines the retry configuration. @@ -372,5 +364,4 @@ public boolean retry() { return retry; } } - } diff --git a/src/main/java/com/google/genai/gaos/utils/AsyncRetryableException.java b/src/main/java/com/google/genai/gaos/utils/AsyncRetryableException.java index 941066e5af3..ded9b7437ae 100644 --- a/src/main/java/com/google/genai/gaos/utils/AsyncRetryableException.java +++ b/src/main/java/com/google/genai/gaos/utils/AsyncRetryableException.java @@ -19,9 +19,8 @@ */ package com.google.genai.gaos.utils; -import java.io.InputStream; - import com.google.genai.gaos.utils.transport.HttpResponse; +import java.io.InputStream; public final class AsyncRetryableException extends Exception { private final HttpResponse response; diff --git a/src/main/java/com/google/genai/gaos/utils/BackoffStrategy.java b/src/main/java/com/google/genai/gaos/utils/BackoffStrategy.java index 9cd0cdeca67..331535f70d2 100644 --- a/src/main/java/com/google/genai/gaos/utils/BackoffStrategy.java +++ b/src/main/java/com/google/genai/gaos/utils/BackoffStrategy.java @@ -22,12 +22,12 @@ import java.util.concurrent.TimeUnit; /** - * Exponential Backoff Strategy with Jitter - * - * The duration between consecutive attempts is calculated as follows: - * intervalMs = min(maxIntervalMs, initialIntervalMs*(baseFactor^attempts) +/- r) - * where baseFactor is the base factor and r a random value between 0 and jitterFactor*intervalMs. - */ + * Exponential Backoff Strategy with Jitter + * + * The duration between consecutive attempts is calculated as follows: + * intervalMs = min(maxIntervalMs, initialIntervalMs*(baseFactor^attempts) +/- r) + * where baseFactor is the base factor and r a random value between 0 and jitterFactor*intervalMs. + */ public class BackoffStrategy { private static final long DEFAULT_INITIAL_INTERVAL_MS = 500L; @@ -46,13 +46,14 @@ public class BackoffStrategy { private final boolean retryConnectError; private final boolean retryReadTimeoutError; - private BackoffStrategy(long initialIntervalMs, - long maxIntervalMs, - long maxElapsedTimeMs, - double baseFactor, - double jitterFactor, - boolean retryConnectError, - boolean retryReadTimeoutError) { + private BackoffStrategy( + long initialIntervalMs, + long maxIntervalMs, + long maxElapsedTimeMs, + double baseFactor, + double jitterFactor, + boolean retryConnectError, + boolean retryReadTimeoutError) { this.initialIntervalMs = initialIntervalMs; this.maxIntervalMs = maxIntervalMs; this.maxElapsedTimeMs = maxElapsedTimeMs; @@ -79,8 +80,8 @@ public double baseFactor() { } /** - * @deprecated use {@link #baseFactor()} instead. - */ + * @deprecated use {@link #baseFactor()} instead. + */ @Deprecated public double exponent() { return baseFactor; @@ -102,11 +103,11 @@ public boolean retryReadTimeoutError() { return retryReadTimeoutError; } - public final static Builder builder() { + public static final Builder builder() { return new Builder(); } - public final static class Builder { + public static final class Builder { private long initialIntervalMs = DEFAULT_INITIAL_INTERVAL_MS; private long maxIntervalMs = DEFAULT_MAX_INTERVAL_MS; @@ -119,12 +120,12 @@ public final static class Builder { private Builder() {} /** - * Sets the initial interval - * - * @param duration The initial interval. - * @param unit The time unit associated with duration. - * @return The builder instance. - */ + * Sets the initial interval + * + * @param duration The initial interval. + * @param unit The time unit associated with duration. + * @return The builder instance. + */ public Builder initialInterval(long duration, TimeUnit unit) { Utils.checkNotNull(unit, "unit"); if (duration < 0) { @@ -135,12 +136,12 @@ public Builder initialInterval(long duration, TimeUnit unit) { } /** - * Sets the maximum interval - * - * @param duration The maximum interval. - * @param unit The time unit associated with duration. - * @return The builder instance. - */ + * Sets the maximum interval + * + * @param duration The maximum interval. + * @param unit The time unit associated with duration. + * @return The builder instance. + */ public Builder maxInterval(long duration, TimeUnit unit) { Utils.checkNotNull(unit, "unit"); if (duration <= 0) { @@ -151,12 +152,12 @@ public Builder maxInterval(long duration, TimeUnit unit) { } /** - * Sets the maximum elapsed time - * - * @param duration The maximum elapsed time. - * @param unit The time unit associated with duration. - * @return The builder instance. - */ + * Sets the maximum elapsed time + * + * @param duration The maximum elapsed time. + * @param unit The time unit associated with duration. + * @return The builder instance. + */ public Builder maxElapsedTime(long duration, TimeUnit unit) { Utils.checkNotNull(unit, "unit"); if (duration < 0) { @@ -167,13 +168,13 @@ public Builder maxElapsedTime(long duration, TimeUnit unit) { } /** - * Sets the backoff base factor. - * - * @param baseFactor The base factor to use. - * @return The builder instance. - */ + * Sets the backoff base factor. + * + * @param baseFactor The base factor to use. + * @return The builder instance. + */ public Builder baseFactor(double baseFactor) { - if (baseFactor <= 0 ) { + if (baseFactor <= 0) { throw new IllegalArgumentException("baseFactor must be strictly positive"); } this.baseFactor = baseFactor; @@ -181,15 +182,15 @@ public Builder baseFactor(double baseFactor) { } /** - * Sets the backoff base factor. - * - * @deprecated use {@link #baseFactor(double)} instead. - * @param baseFactor The base factor to use. - * @return The builder instance. - */ + * Sets the backoff base factor. + * + * @deprecated use {@link #baseFactor(double)} instead. + * @param baseFactor The base factor to use. + * @return The builder instance. + */ @Deprecated public Builder exponent(double baseFactor) { - if (baseFactor <= 0 ) { + if (baseFactor <= 0) { throw new IllegalArgumentException("baseFactor must be strictly positive"); } this.baseFactor = baseFactor; @@ -197,11 +198,11 @@ public Builder exponent(double baseFactor) { } /** - * Sets the jitter factor used to randomize the backoff interval. - * - * @param jitterFactor The jitter factor to use (default is 0.5f). - * @return The builder instance. - */ + * Sets the jitter factor used to randomize the backoff interval. + * + * @param jitterFactor The jitter factor to use (default is 0.5f). + * @return The builder instance. + */ public Builder jitterFactor(double jitterFactor) { if (jitterFactor < 0 || jitterFactor > 1) { throw new IllegalArgumentException("jitterFactor must be between 0 and 1"); @@ -211,55 +212,56 @@ public Builder jitterFactor(double jitterFactor) { } /** - * Specifies whether connection errors should be retried. - * - * @param retry Whether to retry on connection error. - * @return The builder instance. - */ + * Specifies whether connection errors should be retried. + * + * @param retry Whether to retry on connection error. + * @return The builder instance. + */ public Builder retryConnectError(boolean retry) { this.retryConnectError = retry; return this; } /** - * Do not retry on connection error. - * - * @return The builder instance. - */ + * Do not retry on connection error. + * + * @return The builder instance. + */ public Builder throwConnectError() { this.retryConnectError = false; return this; } /** - * Specifies whether Read Timeout errors should be retried. - * - * @param retry Whether to retry on Read Timeout error. - * @return The builder instance. - */ + * Specifies whether Read Timeout errors should be retried. + * + * @param retry Whether to retry on Read Timeout error. + * @return The builder instance. + */ public Builder retryReadTimeoutError(boolean retry) { this.retryReadTimeoutError = retry; return this; } /** - * Do not retry on Read Timeout error. - * - * @return The builder instance. - */ + * Do not retry on Read Timeout error. + * + * @return The builder instance. + */ public Builder throwReadTimeoutError() { this.retryReadTimeoutError = false; return this; } public BackoffStrategy build() { - return new BackoffStrategy(initialIntervalMs, - maxIntervalMs, - maxElapsedTimeMs, - baseFactor, - jitterFactor, - retryConnectError, - retryReadTimeoutError); + return new BackoffStrategy( + initialIntervalMs, + maxIntervalMs, + maxElapsedTimeMs, + baseFactor, + jitterFactor, + retryConnectError, + retryReadTimeoutError); } } } diff --git a/src/main/java/com/google/genai/gaos/utils/BigDecimalString.java b/src/main/java/com/google/genai/gaos/utils/BigDecimalString.java index 5cda1b1509b..4a56489ed05 100644 --- a/src/main/java/com/google/genai/gaos/utils/BigDecimalString.java +++ b/src/main/java/com/google/genai/gaos/utils/BigDecimalString.java @@ -19,10 +19,6 @@ */ package com.google.genai.gaos.utils; -import java.io.IOException; -import java.math.BigDecimal; -import java.util.Objects; - import com.fasterxml.jackson.core.JacksonException; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; @@ -33,6 +29,9 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Objects; // Internal API only @@ -48,20 +47,20 @@ public class BigDecimalString { public BigDecimalString(BigDecimal value) { this.value = value; } - + public BigDecimalString(String value) { this(new BigDecimal(value)); } - + public BigDecimal value() { return value; } - + @Override public String toString() { return value.toString(); } - + @Override public int hashCode() { return Objects.hash(value); @@ -69,16 +68,13 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; BigDecimalString other = (BigDecimalString) obj; return Objects.equals(value, other.value); } - + @SuppressWarnings("serial") public static final class Serializer extends StdSerializer { diff --git a/src/main/java/com/google/genai/gaos/utils/BigIntegerString.java b/src/main/java/com/google/genai/gaos/utils/BigIntegerString.java index 4b9751816e8..282f378147c 100644 --- a/src/main/java/com/google/genai/gaos/utils/BigIntegerString.java +++ b/src/main/java/com/google/genai/gaos/utils/BigIntegerString.java @@ -19,10 +19,6 @@ */ package com.google.genai.gaos.utils; -import java.io.IOException; -import java.math.BigInteger; -import java.util.Objects; - import com.fasterxml.jackson.core.JacksonException; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; @@ -33,6 +29,9 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.math.BigInteger; +import java.util.Objects; // Internal API only @@ -48,20 +47,20 @@ public class BigIntegerString { public BigIntegerString(BigInteger value) { this.value = value; } - + public BigIntegerString(String value) { this(new BigInteger(value)); } - + public BigInteger value() { return value; } - + @Override public String toString() { return value.toString(); } - + @Override public int hashCode() { return Objects.hash(value); @@ -69,16 +68,13 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; BigIntegerString other = (BigIntegerString) obj; return Objects.equals(value, other.value); } - + @SuppressWarnings("serial") public static final class Serializer extends StdSerializer { diff --git a/src/main/java/com/google/genai/gaos/utils/Blob.java b/src/main/java/com/google/genai/gaos/utils/Blob.java index 60d52227cf4..f07087a9b5d 100644 --- a/src/main/java/com/google/genai/gaos/utils/Blob.java +++ b/src/main/java/com/google/genai/gaos/utils/Blob.java @@ -19,6 +19,7 @@ */ package com.google.genai.gaos.utils; +import com.google.genai.gaos.utils.transport.HttpBody; import java.io.FileNotFoundException; import java.io.InputStream; import java.nio.ByteBuffer; @@ -27,8 +28,6 @@ import java.util.List; import java.util.Objects; -import com.google.genai.gaos.utils.transport.HttpBody; - /** * A utility class for creating data blobs from various input sources for use as * request bodies. diff --git a/src/main/java/com/google/genai/gaos/utils/BlockingParser.java b/src/main/java/com/google/genai/gaos/utils/BlockingParser.java index 34f9c715c72..1b5a216e750 100644 --- a/src/main/java/com/google/genai/gaos/utils/BlockingParser.java +++ b/src/main/java/com/google/genai/gaos/utils/BlockingParser.java @@ -98,4 +98,4 @@ public static BlockingParser forJsonLines(Reader reader) { public static BlockingParser forSSE(Reader reader) { return new BlockingParser<>(reader, StreamingParser.forSSE()); } -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/utils/Constants.java b/src/main/java/com/google/genai/gaos/utils/Constants.java index b966b9a6b00..4d2957b88e9 100644 --- a/src/main/java/com/google/genai/gaos/utils/Constants.java +++ b/src/main/java/com/google/genai/gaos/utils/Constants.java @@ -22,5 +22,4 @@ public final class Constants { public static final boolean HAS_CLIENT_CREDENTIALS_BASIC = false; - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/utils/Deserializers.java b/src/main/java/com/google/genai/gaos/utils/Deserializers.java index 35390d084fb..9b9a9977edf 100644 --- a/src/main/java/com/google/genai/gaos/utils/Deserializers.java +++ b/src/main/java/com/google/genai/gaos/utils/Deserializers.java @@ -19,12 +19,6 @@ */ package com.google.genai.gaos.utils; -import java.io.IOException; -import java.time.LocalDate; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -import java.time.format.DateTimeParseException; - import com.fasterxml.jackson.core.JacksonException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; @@ -33,6 +27,11 @@ import com.fasterxml.jackson.databind.Module; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import com.fasterxml.jackson.databind.module.SimpleModule; +import java.io.IOException; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; public final class Deserializers { @@ -43,9 +42,10 @@ public final class Deserializers { public static final JsonDeserializer FLOAT_STRICT = new StrictFloatDeserializer(); public static final JsonDeserializer DOUBLE_STRICT = new StrictDoubleDeserializer(); public static final JsonDeserializer LOCAL_DATE_STRICT = new StrictLocalDateDeserializer(); - public static final JsonDeserializer OFFSET_DATE_TIME_STRICT = new StrictOffsetDateTimeDeserializer(); + public static final JsonDeserializer OFFSET_DATE_TIME_STRICT = + new StrictOffsetDateTimeDeserializer(); public static final JsonDeserializer STRING_STRICT = new StrictStringDeserializer(); - + public static final Module STRICT_DESERIALIZERS = createStrictDeserializersModule(); private static Module createStrictDeserializersModule() { @@ -61,7 +61,7 @@ private static Module createStrictDeserializersModule() { m.addDeserializer(String.class, Deserializers.STRING_STRICT); return m; } - + private static final class StrictBooleanDeserializer extends StdDeserializer { private static final long serialVersionUID = 6014987192625841276L; @@ -71,8 +71,7 @@ private static final class StrictBooleanDeserializer extends StdDeserializer { private static final long serialVersionUID = 5500822592284739392L; @@ -93,8 +92,7 @@ private static final class StrictDoubleDeserializer extends StdDeserializer { private static final long serialVersionUID = 6079282945607228350L; @@ -137,8 +134,7 @@ private static final class StrictIntegerDeserializer extends StdDeserializer - * Each SSE message's {@code data} field is deserialized into the type {@code T}, + * Each SSE message's {@code data} field is deserialized into the type {@code T}, * allowing for easy processing of events as domain objects. *

* *

Event Consumption

*

Events can be consumed in multiple ways:

- * + * *
    *
  • Iteration: Use a for-each loop to process each event:
  • *
@@ -49,7 +48,7 @@ * } * } * } - * + * *
    *
  • Stream API: Consume events as a Java Stream (must be closed after use):
  • *
@@ -75,8 +74,8 @@ *

* *

- * Important: This class implements {@link AutoCloseable} and must be used - * within a try-with-resources block to ensure that underlying streams are + * Important: This class implements {@link AutoCloseable} and must be used + * within a try-with-resources block to ensure that underlying streams are * properly closed after consumption, preventing resource leaks. *

* @@ -95,19 +94,26 @@ public final class EventStream implements Iterable, AutoCloseable { private boolean closed = false; // Internal use only - public EventStream(InputStream in, TypeReference typeReference, ObjectMapper mapper, Optional terminalMessage) { + public EventStream( + InputStream in, TypeReference typeReference, ObjectMapper mapper, Optional terminalMessage) { this(in, typeReference, mapper, terminalMessage, true); } // Internal use only - public EventStream(InputStream in, TypeReference typeReference, ObjectMapper mapper, Optional terminalMessage, boolean dataRequired) { + public EventStream( + InputStream in, + TypeReference typeReference, + ObjectMapper mapper, + Optional terminalMessage, + boolean dataRequired) { BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8), 8192); this.parser = BlockingParser.forSSE(reader); this.typeReference = typeReference; this.mapper = mapper; this.terminalMessage = terminalMessage; this.dataRequired = dataRequired; - logger.debug("EventStream initialized for type: {}", typeReference.getType().getTypeName()); + logger.debug( + "EventStream initialized for type: {}", typeReference.getType().getTypeName()); } /** @@ -125,7 +131,9 @@ public Optional next() throws IOException { return Optional.empty(); } EventStreamMessage msg = message.get(); - boolean isTerminal = terminalMessage.flatMap(sentinel -> msg.data().map(sentinel::equals)).orElse(false); + boolean isTerminal = terminalMessage + .flatMap(sentinel -> msg.data().map(sentinel::equals)) + .orElse(false); if (isTerminal) { terminated = true; if (logger.isTraceEnabled()) { @@ -185,10 +193,7 @@ public Iterator iterator() { * @return streamed events */ public Stream stream() { - return StreamSupport.stream( - Spliterators.spliteratorUnknownSize( - iterator(), - Spliterator.ORDERED), false) + return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator(), Spliterator.ORDERED), false) .onClose(() -> { try { EventStream.this.close(); @@ -244,4 +249,4 @@ private void load() { } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/utils/EventStreamMessage.java b/src/main/java/com/google/genai/gaos/utils/EventStreamMessage.java index cfe19d9974a..2172a9908e3 100644 --- a/src/main/java/com/google/genai/gaos/utils/EventStreamMessage.java +++ b/src/main/java/com/google/genai/gaos/utils/EventStreamMessage.java @@ -28,7 +28,8 @@ public class EventStreamMessage { private final Optional retryMs; private final Optional data; - public EventStreamMessage(Optional event, Optional id, Optional retryMs, Optional data) { + public EventStreamMessage( + Optional event, Optional id, Optional retryMs, Optional data) { this.event = event; this.id = id; this.retryMs = retryMs; diff --git a/src/main/java/com/google/genai/gaos/utils/Exceptions.java b/src/main/java/com/google/genai/gaos/utils/Exceptions.java index 13089422f15..3ed5ca505b1 100644 --- a/src/main/java/com/google/genai/gaos/utils/Exceptions.java +++ b/src/main/java/com/google/genai/gaos/utils/Exceptions.java @@ -18,11 +18,12 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ package com.google.genai.gaos.utils; + +import java.io.IOException; +import java.io.UncheckedIOException; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; -import java.io.IOException; -import java.io.UncheckedIOException; public class Exceptions { public static Exception coerceException(Throwable throwable) { @@ -37,11 +38,11 @@ public static RuntimeException unchecked(Throwable t) { if (t instanceof RuntimeException) { return (RuntimeException) t; } else if (t instanceof Error) { - throw (Error) t; // propagate JVM-level errors properly + throw (Error) t; // propagate JVM-level errors properly } else if (t instanceof IOException) { throw new UncheckedIOException((IOException) t); } else { - throw new RuntimeException(t); + throw new RuntimeException(t); } } diff --git a/src/main/java/com/google/genai/gaos/utils/FormMetadata.java b/src/main/java/com/google/genai/gaos/utils/FormMetadata.java index 5b56f9de3ab..c121fa285f0 100644 --- a/src/main/java/com/google/genai/gaos/utils/FormMetadata.java +++ b/src/main/java/com/google/genai/gaos/utils/FormMetadata.java @@ -28,8 +28,7 @@ class FormMetadata { boolean json; String name; - private FormMetadata() { - } + private FormMetadata() {} // form:name=propName,style=spaceDelimited,explode=true static FormMetadata parse(Field field) throws IllegalArgumentException, IllegalAccessException { diff --git a/src/main/java/com/google/genai/gaos/utils/GenericTypeIdResolver.java b/src/main/java/com/google/genai/gaos/utils/GenericTypeIdResolver.java index d67c66989b7..7beb1f4f83f 100644 --- a/src/main/java/com/google/genai/gaos/utils/GenericTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/utils/GenericTypeIdResolver.java @@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.DatabindContext; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase; - import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -62,4 +61,4 @@ public JavaType typeFromId(DatabindContext context, String id) throws IOExceptio } return context.constructType(unknownType); } -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/utils/Globals.java b/src/main/java/com/google/genai/gaos/utils/Globals.java index d6c6563e37a..4bae3d3c7ff 100644 --- a/src/main/java/com/google/genai/gaos/utils/Globals.java +++ b/src/main/java/com/google/genai/gaos/utils/Globals.java @@ -26,15 +26,13 @@ import java.util.stream.Stream; public final class Globals { - + private final Map queryParams = new HashMap<>(); private final Map pathParams = new HashMap<>(); private final Map headerParams = new HashMap<>(); - - public Globals() { - } - + public Globals() {} + // internal use only public void putParam(String type, String name, Object value) { if ("pathParam".equals(type)) { @@ -47,19 +45,19 @@ public void putParam(String type, String name, Object value) { throw new IllegalArgumentException("Unknown parameter type: " + type); } } - + // internal use only public Optional getParam(String type, String name) { - if ("pathParam".equals(type)){ + if ("pathParam".equals(type)) { return getPathParam(name); } else if ("queryParam".equals(type)) { - return getQueryParam(name); + return getQueryParam(name); } else if ("header".equals(type)) { - return getHeader(name); + return getHeader(name); } else { throw new IllegalArgumentException("Unknown parameter type: " + type); } - } + } public void putQueryParam(String name, Object value) { if (value != null) { @@ -80,9 +78,9 @@ public void putHeader(String name, Object value) { } public Optional getQueryParam(String name) { - return Optional.ofNullable(queryParams.get(name)); + return Optional.ofNullable(queryParams.get(name)); } - + public Optional getPathParam(String name) { return Optional.ofNullable(pathParams.get(name)); } @@ -90,11 +88,11 @@ public Optional getPathParam(String name) { public Optional getHeader(String name) { return Optional.ofNullable(headerParams.get(name)); } - + public Stream> queryParamsAsStream() { return queryParams.entrySet().stream(); } - + public Stream> pathParamsAsStream() { return pathParams.entrySet().stream(); } diff --git a/src/main/java/com/google/genai/gaos/utils/HTTPClient.java b/src/main/java/com/google/genai/gaos/utils/HTTPClient.java index f25e2fc0177..054f8c07e50 100644 --- a/src/main/java/com/google/genai/gaos/utils/HTTPClient.java +++ b/src/main/java/com/google/genai/gaos/utils/HTTPClient.java @@ -19,14 +19,27 @@ */ package com.google.genai.gaos.utils; +import com.google.genai.gaos.utils.transport.HttpRequest; +import com.google.genai.gaos.utils.transport.HttpResponse; import java.io.IOException; import java.io.InputStream; import java.util.concurrent.CompletableFuture; -import com.google.genai.gaos.utils.transport.HttpRequest; -import com.google.genai.gaos.utils.transport.HttpResponse; +public interface HTTPClient extends java.lang.AutoCloseable { -public interface HTTPClient { + /** + * Releases resources owned by this client. + * + *

The default is a no-op so custom implementations that borrow an + * externally owned client are not forced to tear down resources they do + * not own. Implementations that own resources should override this method. + * + * @throws Exception if an owned resource cannot be released + */ + @Override + default void close() throws Exception { + // Default no-op + } /** * Sends an HTTP request and returns the response. diff --git a/src/main/java/com/google/genai/gaos/utils/HTTPRequest.java b/src/main/java/com/google/genai/gaos/utils/HTTPRequest.java index 8063aeed3e8..ee5f0f773a0 100644 --- a/src/main/java/com/google/genai/gaos/utils/HTTPRequest.java +++ b/src/main/java/com/google/genai/gaos/utils/HTTPRequest.java @@ -19,9 +19,9 @@ */ package com.google.genai.gaos.utils; +import com.google.genai.gaos.utils.transport.HttpRequest; import java.net.URI; import java.net.URISyntaxException; -import com.google.genai.gaos.utils.transport.HttpRequest; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -47,12 +47,12 @@ public HTTPRequest(String baseURL, String method) { this.baseURL = baseURL; this.method = method; } - + public void setBody(Optional body) { Utils.checkNotNull(body, "body"); this.body = body; } - + public HTTPRequest addHeader(String key, String value) { List headerValues = headers.get(key); if (headerValues == null) { @@ -64,27 +64,27 @@ public HTTPRequest addHeader(String key, String value) { } return this; } - + public HTTPRequest addHeaders(Map> map) { map.forEach((key, list) -> list.forEach(v -> addHeader(key, v))); return this; } - + public HTTPRequest addQueryParam(QueryParameter param) { this.queryParams.add(param); return this; } - + public HTTPRequest addQueryParam(String key, String value, boolean allowReserved) { this.queryParams.add(QueryParameter.of(key, value, allowReserved)); return this; } - + public HTTPRequest addQueryParams(Collection params) { params.forEach(p -> addQueryParam(p)); return this; } - + public HttpRequest build() { HttpRequest.Builder requestBuilder = HttpRequest.builder().method(method); @@ -100,7 +100,7 @@ public HttpRequest build() { headers.forEach((k, list) -> list.forEach(v -> requestBuilder.header(k, v))); return requestBuilder.build(); } - + // VisibleForTesting public static String buildUrl(String baseURL, Collection queryParams) { if (queryParams.isEmpty()) { @@ -124,18 +124,17 @@ public static String buildUrl(String baseURL, Collection queryPa } boolean first = true; for (QueryParameter p : queryParams) { - if (!first) { - b.append(QUERY_PARAMETER_DELIMITER); - } - first = false; - // don't allow reserved characters to be unencoded in key (??) - b.append(Utf8UrlEncoder.DEFAULT.encode(p.name())); - b.append(QUERY_NAME_VALUE_DELIMITER); - b.append(Utf8UrlEncoder.allowReserved(p.allowReserved()).encode(p.value())); + if (!first) { + b.append(QUERY_PARAMETER_DELIMITER); + } + first = false; + // don't allow reserved characters to be unencoded in key (??) + b.append(Utf8UrlEncoder.DEFAULT.encode(p.name())); + b.append(QUERY_NAME_VALUE_DELIMITER); + b.append(Utf8UrlEncoder.allowReserved(p.allowReserved()).encode(p.value())); } b.append(fragment); return b.toString(); } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/utils/HasSecurity.java b/src/main/java/com/google/genai/gaos/utils/HasSecurity.java index 332a04e68dd..2a516bcabbd 100644 --- a/src/main/java/com/google/genai/gaos/utils/HasSecurity.java +++ b/src/main/java/com/google/genai/gaos/utils/HasSecurity.java @@ -22,5 +22,4 @@ /** * Implemented by classes that have security annotations on fields. **/ -public interface HasSecurity { -} \ No newline at end of file +public interface HasSecurity {} diff --git a/src/main/java/com/google/genai/gaos/utils/HeaderMetadata.java b/src/main/java/com/google/genai/gaos/utils/HeaderMetadata.java index 0d0bad7f790..69570bb0eda 100644 --- a/src/main/java/com/google/genai/gaos/utils/HeaderMetadata.java +++ b/src/main/java/com/google/genai/gaos/utils/HeaderMetadata.java @@ -27,8 +27,7 @@ class HeaderMetadata { boolean explode; String name; - private HeaderMetadata() { - } + private HeaderMetadata() {} // headerParam:style=simple,explode=false,name=apiID static HeaderMetadata parse(Field field) throws IllegalArgumentException, IllegalAccessException { diff --git a/src/main/java/com/google/genai/gaos/utils/Headers.java b/src/main/java/com/google/genai/gaos/utils/Headers.java index 9c5c7840420..8ae38101e4f 100644 --- a/src/main/java/com/google/genai/gaos/utils/Headers.java +++ b/src/main/java/com/google/genai/gaos/utils/Headers.java @@ -23,11 +23,11 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Locale; import java.util.function.BiConsumer; +import java.util.stream.Collectors; // Internal API only @@ -44,10 +44,8 @@ public final class Headers { // Internal use only public Headers(Map> headers) { Utils.checkNotNull(headers, "headers"); - this.map = headers // - .entrySet() // - .stream() // - .map(entry -> Java8Compat.mapEntry(entry.getKey().toLowerCase(Locale.ENGLISH), entry.getValue())) // + this.map = headers.entrySet().stream() + .map(entry -> Java8Compat.mapEntry(entry.getKey().toLowerCase(Locale.ENGLISH), entry.getValue())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); } @@ -58,7 +56,7 @@ public Headers() { /** * Returns all values for a header name. Header name is case-insensitive. - * + * * @param name header name * @return all values for the header name */ @@ -69,7 +67,7 @@ public List get(String name) { /** * Returns the first value for a header name. Header name is case-insensitive. - * + * * @param name header name * @return the first value for the header name */ @@ -92,7 +90,7 @@ public Optional firstValue(String name) { /** * Appends a header value. Header name is case-insensitive. - * + * * @param name header name * @param value header value * @return this @@ -110,28 +108,25 @@ public Headers add(String name, String value) { } return this; } - + public Headers add(Headers headers) { Utils.checkNotNull(headers, "headers"); - headers - .forEach((key, values) -> values.forEach(value -> add(key, value))); + headers.forEach((key, values) -> values.forEach(value -> add(key, value))); return this; } - - public void forEach(BiConsumer> consumer) { + + public void forEach(BiConsumer> consumer) { Utils.checkNotNull(consumer, "consumer"); map.forEach(consumer); } /** * Returns a copy of the headers as a map. Header names are lowercase. - * + * * @return headers as a map */ public Map> map() { - return map // - .entrySet() // - .stream() // + return map.entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, entry -> new ArrayList<>(entry.getValue()))); } @@ -141,11 +136,10 @@ private List values(String name) { @Override public String toString() { - return "Headers[ " // - + map.entrySet() // - .stream() // - .map(entry -> entry.getKey() + "=" + entry.getValue()) // - .collect(Collectors.joining(", ")) // + return "Headers[ " + + map.entrySet().stream() + .map(entry -> entry.getKey() + "=" + entry.getValue()) + .collect(Collectors.joining(", ")) + "]"; } } diff --git a/src/main/java/com/google/genai/gaos/utils/Hook.java b/src/main/java/com/google/genai/gaos/utils/Hook.java index ee73cb53d7e..d289172609a 100644 --- a/src/main/java/com/google/genai/gaos/utils/Hook.java +++ b/src/main/java/com/google/genai/gaos/utils/Hook.java @@ -19,16 +19,15 @@ */ package com.google.genai.gaos.utils; -import java.io.InputStream; +import com.google.genai.gaos.SDKConfiguration; +import com.google.genai.gaos.SecuritySource; import com.google.genai.gaos.utils.transport.HttpRequest; import com.google.genai.gaos.utils.transport.HttpResponse; +import java.io.InputStream; import java.util.List; import java.util.Optional; import java.util.UUID; -import com.google.genai.gaos.SDKConfiguration; -import com.google.genai.gaos.SecuritySource; - /** * Holder class for hook-associated types. This class does not get * instantiated. @@ -44,39 +43,47 @@ private Hook() { */ public interface HookContext { SDKConfiguration sdkConfiguration(); + String baseUrl(); + String operationId(); + Optional> oauthScopes(); + Optional securitySource(); } - + /** * Context for a BeforeRequest hook call. */ - public interface BeforeRequestContext extends HookContext { - } - + public interface BeforeRequestContext extends HookContext {} + public static final class BeforeRequestContextImpl implements BeforeRequestContext { - + private final SDKConfiguration sdkConfiguration; private final String baseUrl; private final String operationId; private final Optional> oauthScopes; private final Optional securitySource; - - public BeforeRequestContextImpl(SDKConfiguration sdkConfiguration, String baseUrl, String operationId, Optional> oauthScopes, Optional securitySource) { + + public BeforeRequestContextImpl( + SDKConfiguration sdkConfiguration, + String baseUrl, + String operationId, + Optional> oauthScopes, + Optional securitySource) { this.sdkConfiguration = sdkConfiguration; this.baseUrl = baseUrl; this.operationId = operationId; this.oauthScopes = oauthScopes; this.securitySource = securitySource; } - + @Override public SDKConfiguration sdkConfiguration() { return sdkConfiguration; } - + @Override public String baseUrl() { return baseUrl; @@ -86,33 +93,37 @@ public String baseUrl() { public String operationId() { return operationId; } - + @Override public Optional securitySource() { return securitySource; } - + @Override public Optional> oauthScopes() { return oauthScopes; } } - + /** * Context for an AfterSuccess hook call. */ - public interface AfterSuccessContext extends HookContext { - } - + public interface AfterSuccessContext extends HookContext {} + public static final class AfterSuccessContextImpl implements AfterSuccessContext { - + private final SDKConfiguration sdkConfiguration; private final String baseUrl; private final String operationId; private final Optional> oauthScopes; private final Optional securitySource; - - public AfterSuccessContextImpl(SDKConfiguration sdkConfiguration, String baseUrl, String operationId, Optional> oauthScopes, Optional securitySource) { + + public AfterSuccessContextImpl( + SDKConfiguration sdkConfiguration, + String baseUrl, + String operationId, + Optional> oauthScopes, + Optional securitySource) { Utils.checkNotNull(securitySource, "securitySource"); this.sdkConfiguration = sdkConfiguration; this.baseUrl = baseUrl; @@ -120,12 +131,12 @@ public AfterSuccessContextImpl(SDKConfiguration sdkConfiguration, String baseUrl this.oauthScopes = oauthScopes; this.securitySource = securitySource; } - + @Override public SDKConfiguration sdkConfiguration() { return sdkConfiguration; } - + @Override public String baseUrl() { return baseUrl; @@ -135,13 +146,13 @@ public String baseUrl() { public String operationId() { return operationId; } - + @Override public Optional securitySource() { return securitySource; } - - @Override + + @Override public Optional> oauthScopes() { return oauthScopes; } @@ -150,18 +161,22 @@ public Optional> oauthScopes() { /** * Context for an AfterError hook call. */ - public interface AfterErrorContext extends HookContext { - } - + public interface AfterErrorContext extends HookContext {} + public static final class AfterErrorContextImpl implements AfterErrorContext { - + private final SDKConfiguration sdkConfiguration; private final String baseUrl; private final String operationId; private final Optional> oauthScopes; private final Optional securitySource; - - public AfterErrorContextImpl(SDKConfiguration sdkConfiguration, String baseUrl, String operationId, Optional> oauthScopes, Optional securitySource) { + + public AfterErrorContextImpl( + SDKConfiguration sdkConfiguration, + String baseUrl, + String operationId, + Optional> oauthScopes, + Optional securitySource) { Utils.checkNotNull(securitySource, "securitySource"); this.sdkConfiguration = sdkConfiguration; this.baseUrl = baseUrl; @@ -174,22 +189,22 @@ public AfterErrorContextImpl(SDKConfiguration sdkConfiguration, String baseUrl, public SDKConfiguration sdkConfiguration() { return sdkConfiguration; } - + @Override public String baseUrl() { return baseUrl; } - + @Override public String operationId() { return operationId; } - + @Override public Optional securitySource() { return securitySource; } - + @Override public Optional> oauthScopes() { return oauthScopes; @@ -227,7 +242,7 @@ public interface AfterSuccess { /** * Transforms the given response before response processing occurs. - * + * * @param context context for the hook call * @param response response to be transformed * @return transformed response @@ -248,29 +263,26 @@ HttpResponse afterSuccess(AfterSuccessContext context, HttpResponse public interface AfterError { /** - * Either returns an HttpResponse or throws an Exception. Must be passed either + * Either returns an HttpResponse or throws an Exception. Must be passed either * a response or an error (both can't be absent). - * + * * @param context context for the error * @param response response information if available. * @param error the optional exception. If response present then the error is for-info - * only, it was the last error in the chain of AfterError hook + * only, it was the last error in the chain of AfterError hook * calls leading to this one * @return HTTP response if method decides that an exception is not to be thrown * @throws Exception if error to be propagated */ HttpResponse afterError( - AfterErrorContext context, - Optional> response, - Optional error) throws Exception; + AfterErrorContext context, Optional> response, Optional error) throws Exception; /** * The default action is to rethrow the given error. */ static AfterError DEFAULT = (context, response, error) -> { Utils.checkArgument( - response.isPresent() ^ error.isPresent(), - "one and only one of response or error must be present"); + response.isPresent() ^ error.isPresent(), "one and only one of response or error must be present"); if (error.isPresent()) { throw error.get(); } else { @@ -278,30 +290,28 @@ HttpResponse afterError( } }; } - + /** * Transforms the HTTPClient before use. */ public interface SdkInit { - + /** * Returns a transformed {@link SDKConfiguration} for use in initialized SDKs. - * + * * @param config config to transform * @return the transformed config */ - SDKConfiguration sdkInit(SDKConfiguration config); - + SDKConfiguration sdkInit(SDKConfiguration config); + /** * The default action is to return the config untouched. */ - static SdkInit DEFAULT = config -> config; - - + static SdkInit DEFAULT = config -> config; } - + public static final class IdempotencyHook implements BeforeRequest { - + @Override public HttpRequest beforeRequest(BeforeRequestContext context, HttpRequest request) throws Exception { HttpRequest.Builder b = request.toBuilder(); diff --git a/src/main/java/com/google/genai/gaos/utils/HookAdapters.java b/src/main/java/com/google/genai/gaos/utils/HookAdapters.java index f135cd47391..a60ad81e0d1 100644 --- a/src/main/java/com/google/genai/gaos/utils/HookAdapters.java +++ b/src/main/java/com/google/genai/gaos/utils/HookAdapters.java @@ -27,15 +27,15 @@ *

* This class provides adapter methods that convert synchronous hook implementations * ({@link Hook.BeforeRequest}, {@link Hook.AfterSuccess}, {@link Hook.AfterError}) - * to their asynchronous counterparts ({@link AsyncHook.BeforeRequest}, + * to their asynchronous counterparts ({@link AsyncHook.BeforeRequest}, * {@link AsyncHook.AfterSuccess}, {@link AsyncHook.AfterError}). *

- * Performance Note: The execution of synchronous hooks is offloaded to the + * Performance Note: The execution of synchronous hooks is offloaded to the * default asynchronous execution facility used by {@link CompletableFuture}. - * For better performance in high-throughput scenarios, consider re-implementing + * For better performance in high-throughput scenarios, consider re-implementing * hooks using non-blocking I/O (NIO) patterns instead of relying on these adapters. *

- * Thread Safety: All adapter methods are thread-safe and can be called + * Thread Safety: All adapter methods are thread-safe and can be called * concurrently from multiple threads. * * @see Hook @@ -67,7 +67,8 @@ private HookAdapters() { */ public static AsyncHook.BeforeRequest toAsync(Hook.BeforeRequest beforeRequestHook) { return ((context, request) -> CompletableFuture.supplyAsync( - () -> Exceptions.unchecked(() -> beforeRequestHook.beforeRequest(context, request)).get())); + () -> Exceptions.unchecked(() -> beforeRequestHook.beforeRequest(context, request)) + .get())); } /** @@ -89,13 +90,12 @@ public static AsyncHook.BeforeRequest toAsync(Hook.BeforeRequest beforeRequestHo * @throws NullPointerException if {@code afterErrorHook} is {@code null} */ public static AsyncHook.AfterError toAsync(Hook.AfterError afterErrorHook) { - return (context, response, error) -> CompletableFuture.supplyAsync(() -> - Exceptions.unchecked(() -> - afterErrorHook.afterError( - context, - Optional.ofNullable(response), - Optional.ofNullable(error).map(Exceptions::coerceException))).get()); - + return (context, response, error) -> CompletableFuture.supplyAsync( + () -> Exceptions.unchecked(() -> afterErrorHook.afterError( + context, + Optional.ofNullable(response), + Optional.ofNullable(error).map(Exceptions::coerceException))) + .get()); } /** @@ -117,9 +117,8 @@ public static AsyncHook.AfterError toAsync(Hook.AfterError afterErrorHook) { * @throws NullPointerException if {@code afterSuccessHook} is {@code null} */ public static AsyncHook.AfterSuccess toAsync(Hook.AfterSuccess afterSuccessHook) { - return (context, response) -> CompletableFuture.supplyAsync(() -> - Exceptions.unchecked(() -> - afterSuccessHook.afterSuccess(context, response)).get()); - + return (context, response) -> CompletableFuture.supplyAsync( + () -> Exceptions.unchecked(() -> afterSuccessHook.afterSuccess(context, response)) + .get()); } -} \ No newline at end of file +} diff --git a/src/main/java/com/google/genai/gaos/utils/Hooks.java b/src/main/java/com/google/genai/gaos/utils/Hooks.java index 426cdab916e..06028305412 100644 --- a/src/main/java/com/google/genai/gaos/utils/Hooks.java +++ b/src/main/java/com/google/genai/gaos/utils/Hooks.java @@ -19,13 +19,7 @@ */ package com.google.genai.gaos.utils; -import java.io.InputStream; -import com.google.genai.gaos.utils.transport.HttpRequest; -import com.google.genai.gaos.utils.transport.HttpResponse; -import java.util.List; -import java.util.Optional; -import java.util.concurrent.CopyOnWriteArrayList; - +import com.google.genai.gaos.SDKConfiguration; import com.google.genai.gaos.utils.Hook.AfterError; import com.google.genai.gaos.utils.Hook.AfterErrorContext; import com.google.genai.gaos.utils.Hook.AfterSuccess; @@ -33,15 +27,20 @@ import com.google.genai.gaos.utils.Hook.BeforeRequest; import com.google.genai.gaos.utils.Hook.BeforeRequestContext; import com.google.genai.gaos.utils.Hook.SdkInit; -import com.google.genai.gaos.SDKConfiguration; +import com.google.genai.gaos.utils.transport.HttpRequest; +import com.google.genai.gaos.utils.transport.HttpResponse; +import java.io.InputStream; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CopyOnWriteArrayList; /** * Registers hooks for use at runtime by an end-user or for use by a customer * that may edit the SDKHooks.java file. - * + * *

* For example, this code will add a transaction id header to every request: - * + * *

  * hooks.registerBeforeRequest((context, request) -> {
  *     return request.toBuilder()
@@ -60,12 +59,11 @@ public class Hooks implements BeforeRequest, AfterSuccess, AfterError, SdkInit {
     private final List afterSuccessHooks = new CopyOnWriteArrayList<>();
     private final List afterErrorHooks = new CopyOnWriteArrayList<>();
     private final List SdkInitHooks = new CopyOnWriteArrayList<>();
-    
+
     /**
      * Constructor.
      */
-    public Hooks() {
-    }
+    public Hooks() {}
 
     /**
      * Registers a {@link BeforeRequest} hook to be applied in order of
@@ -73,14 +71,17 @@ public Hooks() {
      * the second BeforeRequest hook and processed similarly for the rest of the
      * registered hooks. If a BeforeRequest hook throws then that Exception will
      * not be passed to the {@link AfterError} hooks.
-     * 
+     *
      * @param beforeRequest hook to be registered
      * @return this
      */
     public Hooks registerBeforeRequest(BeforeRequest beforeRequest) {
         Utils.checkNotNull(beforeRequest, "beforeRequest");
         this.beforeRequestHooks.add(beforeRequest);
-        logger.debug("Registered BeforeRequest hook: {} (total: {})", beforeRequest.getClass().getSimpleName(), beforeRequestHooks.size());
+        logger.debug(
+                "Registered BeforeRequest hook: {} (total: {})",
+                beforeRequest.getClass().getSimpleName(),
+                beforeRequestHooks.size());
         return this;
     }
 
@@ -90,55 +91,65 @@ public Hooks registerBeforeRequest(BeforeRequest beforeRequest) {
      * be passed to the second AfterSuccess hook and processed similarly for the
      * rest of the registered hooks. If an AfterSuccess hook throws then that
      * Exception will not be passed to the {@link AfterError} hooks.
-     * 
+     *
      * @param afterSuccess hook to be registered
      * @return this
      */
     public Hooks registerAfterSuccess(AfterSuccess afterSuccess) {
         Utils.checkNotNull(afterSuccess, "afterSuccess");
         this.afterSuccessHooks.add(afterSuccess);
-        logger.debug("Registered AfterSuccess hook: {} (total: {})", afterSuccess.getClass().getSimpleName(), afterSuccessHooks.size());
+        logger.debug(
+                "Registered AfterSuccess hook: {} (total: {})",
+                afterSuccess.getClass().getSimpleName(),
+                afterSuccessHooks.size());
         return this;
     }
 
     /**
      * Registers an {@link AfterError} hook to be applied in order of registration
-     * (multiple can be registered). If the first AfterError hook throws then the 
-     * second hook will be called with that exception (and no response object) and 
-     * so on for the rest of the registered hooks. If an AfterError hook returns 
+     * (multiple can be registered). If the first AfterError hook throws then the
+     * second hook will be called with that exception (and no response object) and
+     * so on for the rest of the registered hooks. If an AfterError hook returns
      * normally then its result will be passed through to the next AfterError hook
-     * with the latest thrown Exception. 
-     * 
+     * with the latest thrown Exception.
+     *
      * @param afterError hook to be registered
      * @return this
      */
     public Hooks registerAfterError(AfterError afterError) {
         Utils.checkNotNull(afterError, "afterError");
         this.afterErrorHooks.add(afterError);
-        logger.debug("Registered AfterError hook: {} (total: {})", afterError.getClass().getSimpleName(), afterErrorHooks.size());
+        logger.debug(
+                "Registered AfterError hook: {} (total: {})",
+                afterError.getClass().getSimpleName(),
+                afterErrorHooks.size());
         return this;
     }
 
     /**
      * Registers a {@link SdkInit} hook to be applied in order of registration
      * (multiple can be registered).
-     * 
+     *
      * @param SdkInit hook to be registered
      * @return this
      */
     public Hooks registerSdkInit(SdkInit SdkInit) {
         Utils.checkNotNull(SdkInit, "SdkInit");
         this.SdkInitHooks.add(SdkInit);
-        logger.debug("Registered SdkInit hook: {} (total: {})", SdkInit.getClass().getSimpleName(), SdkInitHooks.size());
+        logger.debug(
+                "Registered SdkInit hook: {} (total: {})", SdkInit.getClass().getSimpleName(), SdkInitHooks.size());
         return this;
     }
-    
+
     @Override
     public HttpRequest beforeRequest(BeforeRequestContext context, HttpRequest request) throws Exception {
         Utils.checkNotNull(context, "context");
         Utils.checkNotNull(request, "request");
         if (logger.isTraceEnabled() && !beforeRequestHooks.isEmpty()) {
-            logger.trace("Executing {} beforeRequest hook(s) for operation: {}", beforeRequestHooks.size(), context.operationId());
+            logger.trace(
+                    "Executing {} beforeRequest hook(s) for operation: {}",
+                    beforeRequestHooks.size(),
+                    context.operationId());
         }
         for (BeforeRequest hook : beforeRequestHooks) {
             request = hook.beforeRequest(context, request);
@@ -153,7 +164,10 @@ public HttpResponse afterSuccess(AfterSuccessContext context, HttpR
         Utils.checkNotNull(response, "response");
 
         if (logger.isTraceEnabled() && !afterSuccessHooks.isEmpty()) {
-            logger.trace("Executing {} afterSuccess hook(s) for operation: {}", afterSuccessHooks.size(), context.operationId());
+            logger.trace(
+                    "Executing {} afterSuccess hook(s) for operation: {}",
+                    afterSuccessHooks.size(),
+                    context.operationId());
         }
         for (AfterSuccess hook : afterSuccessHooks) {
             response = hook.afterSuccess(context, response);
@@ -166,18 +180,16 @@ public HttpResponse afterSuccess(AfterSuccessContext context, HttpR
 
     @Override
     public HttpResponse afterError(
-            AfterErrorContext context,
-            Optional> response,
-            Optional error) throws Exception {
+            AfterErrorContext context, Optional> response, Optional error) throws Exception {
         Utils.checkNotNull(context, "context");
         Utils.checkNotNull(response, "response");
         Utils.checkNotNull(error, "error");
         Utils.checkArgument(
-               response.isPresent() ^ error.isPresent(),
-               "one and only one of response or error must be present");
-        
+                response.isPresent() ^ error.isPresent(), "one and only one of response or error must be present");
+
         if (logger.isTraceEnabled() && !afterErrorHooks.isEmpty()) {
-            logger.trace("Executing {} afterError hook(s) for operation: {}", afterErrorHooks.size(), context.operationId());
+            logger.trace(
+                    "Executing {} afterError hook(s) for operation: {}", afterErrorHooks.size(), context.operationId());
         }
         for (AfterError hook : afterErrorHooks) {
             try {
@@ -186,19 +198,19 @@ public HttpResponse afterError(
                     throw new IllegalStateException(
                             "afterError must either throw an exception or return a non-null response");
                 }
-             } catch (FailEarlyException e) {
-                 Throwable cause = e.getCause();
-                 if (cause instanceof Exception) {
-                     throw (Exception) cause;
-                 } else {
-                     // must be an Error
-                     throw (Error) cause;
-                 }
-             } catch (Exception e) {
-                 logger.debug("Hook threw exception: {}", e.getClass().getSimpleName());
-                 error = Optional.of(e);
-                 response = Optional.empty();
-             }
+            } catch (FailEarlyException e) {
+                Throwable cause = e.getCause();
+                if (cause instanceof Exception) {
+                    throw (Exception) cause;
+                } else {
+                    // must be an Error
+                    throw (Error) cause;
+                }
+            } catch (Exception e) {
+                logger.debug("Hook threw exception: {}", e.getClass().getSimpleName());
+                error = Optional.of(e);
+                response = Optional.empty();
+            }
         }
         if (response.isPresent()) {
             return response.get();
@@ -228,5 +240,4 @@ public FailEarlyException(Exception e) {
             super(e);
         }
     }
-
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/google/genai/gaos/utils/JSON.java b/src/main/java/com/google/genai/gaos/utils/JSON.java
index 0508e99dc6a..b74a98aa335 100644
--- a/src/main/java/com/google/genai/gaos/utils/JSON.java
+++ b/src/main/java/com/google/genai/gaos/utils/JSON.java
@@ -21,12 +21,11 @@
 
 import com.fasterxml.jackson.annotation.JsonAutoDetect;
 import com.fasterxml.jackson.annotation.PropertyAccessor;
-
 import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
 import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
 import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
-import com.fasterxml.jackson.databind.ObjectMapper;
 
 public class JSON {
     private static final ObjectMapper MAPPER = new ObjectMapper()
@@ -38,7 +37,8 @@ public class JSON {
             .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
             .enable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)
             .setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
+
     public static ObjectMapper getMapper() {
         return MAPPER;
     }
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/google/genai/gaos/utils/Java8Compat.java b/src/main/java/com/google/genai/gaos/utils/Java8Compat.java
index 0ed1e8253d7..8ea82f842f0 100644
--- a/src/main/java/com/google/genai/gaos/utils/Java8Compat.java
+++ b/src/main/java/com/google/genai/gaos/utils/Java8Compat.java
@@ -155,8 +155,7 @@ private static  void add(Map map, K key, V value) {
     }
 
     public static  Map.Entry mapEntry(K key, V value) {
-        return new AbstractMap.SimpleImmutableEntry<>(
-                Objects.requireNonNull(key), Objects.requireNonNull(value));
+        return new AbstractMap.SimpleImmutableEntry<>(Objects.requireNonNull(key), Objects.requireNonNull(value));
     }
 
     public static  Set setCopyOf(Collection collection) {
@@ -193,4 +192,4 @@ public static  CompletableFuture failedFuture(Throwable ex) {
         future.completeExceptionally(ex);
         return future;
     }
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/google/genai/gaos/utils/LazySingletonValue.java b/src/main/java/com/google/genai/gaos/utils/LazySingletonValue.java
index 753941e7dd8..00411e21db3 100644
--- a/src/main/java/com/google/genai/gaos/utils/LazySingletonValue.java
+++ b/src/main/java/com/google/genai/gaos/utils/LazySingletonValue.java
@@ -22,14 +22,14 @@
 import com.fasterxml.jackson.core.type.TypeReference;
 
 public final class LazySingletonValue {
-    
+
     private static final Object NOT_SET = new Object();
-    
+
     private final String name;
     private final String json;
     private final TypeReference typeReference;
     private Object value = NOT_SET;
-    
+
     public LazySingletonValue(String name, String json, TypeReference typeReference) {
         this.name = name;
         this.json = json;
diff --git a/src/main/java/com/google/genai/gaos/utils/Metadata.java b/src/main/java/com/google/genai/gaos/utils/Metadata.java
index 5206b6142db..3008b2dcdd0 100644
--- a/src/main/java/com/google/genai/gaos/utils/Metadata.java
+++ b/src/main/java/com/google/genai/gaos/utils/Metadata.java
@@ -29,8 +29,7 @@ private Metadata() {
         // prevent instantiation
     }
 
-    static  T parse(String name, T metadata, Field field)
-            throws IllegalArgumentException, IllegalAccessException {
+    static  T parse(String name, T metadata, Field field) throws IllegalArgumentException, IllegalAccessException {
         SpeakeasyMetadata md = field.getAnnotation(SpeakeasyMetadata.class);
         if (md == null) {
             return null;
@@ -95,4 +94,4 @@ static  T parse(String name, T metadata, Field field)
 
         return (T) metadata;
     }
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/google/genai/gaos/utils/Multipart.java b/src/main/java/com/google/genai/gaos/utils/Multipart.java
index e41bf6a6955..e9f245b7330 100644
--- a/src/main/java/com/google/genai/gaos/utils/Multipart.java
+++ b/src/main/java/com/google/genai/gaos/utils/Multipart.java
@@ -19,6 +19,7 @@
  */
 package com.google.genai.gaos.utils;
 
+import com.google.genai.gaos.utils.transport.HttpBody;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.SequenceInputStream;
@@ -28,14 +29,12 @@
 import java.nio.charset.StandardCharsets;
 import java.util.*;
 
-import com.google.genai.gaos.utils.transport.HttpBody;
-
 public final class Multipart {
 
     private static final String CRLF = "\r\n";
     private static final String DASHES = "--";
     private static final Charset HDR_CS = StandardCharsets.ISO_8859_1; // headers
-    private static final Charset TXT_CS = StandardCharsets.UTF_8;      // text fields
+    private static final Charset TXT_CS = StandardCharsets.UTF_8; // text fields
     private static final String DEFAULT_FILE_CT = "application/octet-stream";
     public static final String DEFAULT_TEXT_CT = "text/plain; charset=UTF-8";
 
@@ -99,8 +98,7 @@ public Builder addPart(String name, Blob blob, String filename, String contentTy
             Utils.checkNotNull(name, "name");
             Utils.checkNotNull(blob, "blob");
             Utils.checkNotNull(filename, "filename");
-            parts.add(new FilePart(name, blob, filename,
-                    Optional.ofNullable(contentType).orElse(DEFAULT_FILE_CT)));
+            parts.add(new FilePart(name, blob, filename, Optional.ofNullable(contentType).orElse(DEFAULT_FILE_CT)));
             return this;
         }
 
@@ -142,10 +140,15 @@ static final class FormField implements Part {
 
         @Override
         public HttpBody toBody(String boundary) {
-            String header = DASHES + boundary + CRLF +
-                    "Content-Disposition: form-data; name=\"" + escapeQuoted(name) + "\"" + CRLF +
-                    "Content-Type: " + contentType + CRLF +
-                    CRLF;
+            String header = DASHES + boundary + CRLF
+                    + "Content-Disposition: form-data; name=\""
+                    + escapeQuoted(name)
+                    + "\""
+                    + CRLF
+                    + "Content-Type: "
+                    + contentType
+                    + CRLF
+                    + CRLF;
 
             HttpBody h = HttpBody.of(header.getBytes(HDR_CS));
             HttpBody b = HttpBody.of(value.getBytes(TXT_CS));
@@ -174,10 +177,14 @@ static final class FilePart implements Part {
         @Override
         public HttpBody toBody(String boundary) {
             String cd = contentDispositionWithFilename(name, filename);
-            String header = DASHES + boundary + CRLF +
-                    "Content-Disposition: " + cd + CRLF +
-                    "Content-Type: " + contentType + CRLF +
-                    CRLF;
+            String header = DASHES + boundary + CRLF
+                    + "Content-Disposition: "
+                    + cd
+                    + CRLF
+                    + "Content-Type: "
+                    + contentType
+                    + CRLF
+                    + CRLF;
 
             HttpBody h = HttpBody.of(header.getBytes(HDR_CS));
             HttpBody c = blob.toHttpBody();
@@ -262,26 +269,26 @@ public boolean isRepeatable() {
             @Override
             public InputStream stream() throws IOException {
                 final Iterator it = bodies.iterator();
-                Enumeration en = new Enumeration() {
-                    @Override
-                    public boolean hasMoreElements() {
-                        return it.hasNext();
-                    }
-
-                    @Override
-                    public InputStream nextElement() {
-                        try {
-                            return it.next().stream();
-                        } catch (IOException e) {
-                            throw new UncheckedIOException(e);
-                        } catch (IllegalStateException e) {
-                            throw new UncheckedIOException(new IOException(e.getMessage(), e));
-                        }
-                    }
-                };
+                Enumeration en =
+                        new Enumeration() {
+                            @Override
+                            public boolean hasMoreElements() {
+                                return it.hasNext();
+                            }
+
+                            @Override
+                            public InputStream nextElement() {
+                                try {
+                                    return it.next().stream();
+                                } catch (IOException e) {
+                                    throw new UncheckedIOException(e);
+                                } catch (IllegalStateException e) {
+                                    throw new UncheckedIOException(new IOException(e.getMessage(), e));
+                                }
+                            }
+                        };
                 return new SequenceInputStream(en);
             }
         };
     }
-
 }
diff --git a/src/main/java/com/google/genai/gaos/utils/MultipartFormMetadata.java b/src/main/java/com/google/genai/gaos/utils/MultipartFormMetadata.java
index aa65eb5a4c5..ce78328c3fc 100644
--- a/src/main/java/com/google/genai/gaos/utils/MultipartFormMetadata.java
+++ b/src/main/java/com/google/genai/gaos/utils/MultipartFormMetadata.java
@@ -28,8 +28,7 @@ class MultipartFormMetadata {
     boolean json;
     String name;
 
-    private MultipartFormMetadata() {
-    }
+    private MultipartFormMetadata() {}
 
     // multipartForm:name=file
     static MultipartFormMetadata parse(Field field) throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/main/java/com/google/genai/gaos/utils/NameValue.java b/src/main/java/com/google/genai/gaos/utils/NameValue.java
index da98cdc4cd3..573a58f3918 100644
--- a/src/main/java/com/google/genai/gaos/utils/NameValue.java
+++ b/src/main/java/com/google/genai/gaos/utils/NameValue.java
@@ -35,4 +35,4 @@ String name() {
     String value() {
         return value;
     }
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/google/genai/gaos/utils/OneOfDeserializer.java b/src/main/java/com/google/genai/gaos/utils/OneOfDeserializer.java
index e2e01c569cf..7d5f06b6594 100644
--- a/src/main/java/com/google/genai/gaos/utils/OneOfDeserializer.java
+++ b/src/main/java/com/google/genai/gaos/utils/OneOfDeserializer.java
@@ -19,6 +19,18 @@
  */
 package com.google.genai.gaos.utils;
 
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.TreeNode;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DatabindException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape;
 import java.io.IOException;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
@@ -36,21 +48,6 @@
 import java.util.Set;
 import java.util.stream.Collectors;
 
-import com.google.genai.gaos.utils.Utils.TypeReferenceWithShape;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.TreeNode;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.DatabindException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JavaType;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
-
-
 public class OneOfDeserializer extends StdDeserializer {
 
     private static final long serialVersionUID = -1;
@@ -79,8 +76,8 @@ public T deserialize(JsonParser p, DeserializationContext ctxt) throws IOExcepti
         return deserializeOneOf(mapper, tree, typeReferences, cls);
     }
 
-    private static  T deserializeOneOf(ObjectMapper mapper, TreeNode tree,
-            List typeReferences, Class cls) throws JsonProcessingException {
+    private static  T deserializeOneOf(
+            ObjectMapper mapper, TreeNode tree, List typeReferences, Class cls) throws JsonProcessingException {
         // TODO don't have to generate json because can use tree.traverse to get a
         // parser to read value, perf advantage and can stop plugging in ObjectMapper
         String json = mapper.writeValueAsString(tree);
@@ -112,7 +109,7 @@ private static  T deserializeOneOf(ObjectMapper mapper, TreeNode tree,
         if (!matches.isEmpty()) {
             return matches.get(0).value;
         }
-        
+
         // No types matched - fall back to JsonNode
         // TreeNode is already parsed, just cast to JsonNode
         JsonNode node;
@@ -122,10 +119,9 @@ private static  T deserializeOneOf(ObjectMapper mapper, TreeNode tree,
             // Shouldn't happen with Jackson's default implementation, but handle gracefully
             node = mapper.readTree(json);
         }
-        
+
         // Wrap JsonNode in TypedObject and create union instance
-        TypedObject typed = TypedObject.of(node, Utils.JsonShape.DEFAULT,
-            new TypeReference() {});
+        TypedObject typed = TypedObject.of(node, Utils.JsonShape.DEFAULT, new TypeReference() {});
         return newInstance(cls, typed);
     }
     /**
@@ -137,9 +133,9 @@ private static final class Match implements Comparable> {
         final TypeReferenceWithShape typeReference;
         final T value;
         private final TreeNode tree;
-        private int matched = 0;    // Count of matched fields (includes inexact)
-        private int inexact = 0;    // Count of fields with unknown/unrecognized enum values
-        private int unmatched = 0;  // Count of struct fields not found in raw JSON
+        private int matched = 0; // Count of matched fields (includes inexact)
+        private int inexact = 0; // Count of fields with unknown/unrecognized enum values
+        private int unmatched = 0; // Count of struct fields not found in raw JSON
 
         Match(TypeReferenceWithShape typeReference, T value, TreeNode tree) {
             this.typeReference = typeReference;
@@ -246,7 +242,7 @@ private void countFieldsRecursive(Object obj, JsonNode jsonNode) {
                         field.setAccessible(true);
                         Object fieldValue = field.get(obj);
                         String fieldName = getJsonFieldName(field);
-                        
+
                         if (fieldName == null) {
                             continue; // Skip fields marked with @JsonIgnore or json:"-"
                         }
@@ -281,7 +277,7 @@ private String getJsonFieldName(Field field) {
             // Check for @JsonProperty - only include fields with Jackson annotations
             if (field.isAnnotationPresent(com.fasterxml.jackson.annotation.JsonProperty.class)) {
                 com.fasterxml.jackson.annotation.JsonProperty prop =
-                    field.getAnnotation(com.fasterxml.jackson.annotation.JsonProperty.class);
+                        field.getAnnotation(com.fasterxml.jackson.annotation.JsonProperty.class);
                 String value = prop.value();
                 if (value != null && !value.isEmpty()) {
                     return value;
@@ -357,17 +353,17 @@ private static Object unwrapValue(Object wrapper) {
 
     private static boolean isPrimitiveOrString(Object obj) {
         Class clazz = obj.getClass();
-        return clazz.isPrimitive() ||
-                clazz == String.class ||
-                clazz == Integer.class ||
-                clazz == Long.class ||
-                clazz == Double.class ||
-                clazz == Float.class ||
-                clazz == Boolean.class ||
-                clazz == BigDecimal.class ||
-                clazz == BigInteger.class ||
-                clazz == OffsetDateTime.class ||
-                clazz == LocalDate.class;
+        return clazz.isPrimitive()
+                || clazz == String.class
+                || clazz == Integer.class
+                || clazz == Long.class
+                || clazz == Double.class
+                || clazz == Float.class
+                || clazz == Boolean.class
+                || clazz == BigDecimal.class
+                || clazz == BigInteger.class
+                || clazz == OffsetDateTime.class
+                || clazz == LocalDate.class;
     }
 
     private static final Set NUMERIC_CLASSES = Java8Compat.setOf(
@@ -379,19 +375,14 @@ private static boolean isPrimitiveOrString(Object obj) {
             BigDecimal.class.getCanonicalName());
 
     private static final Set DECIMAL_CLASSES = Java8Compat.setOf(
-            Float.class.getCanonicalName(),
-            Double.class.getCanonicalName(),
-            BigDecimal.class.getCanonicalName());
-    
+            Float.class.getCanonicalName(), Double.class.getCanonicalName(), BigDecimal.class.getCanonicalName());
+
     private static final Set INTEGER_CLASSES = Java8Compat.setOf(
-            Integer.class.getCanonicalName(),
-            Long.class.getCanonicalName(),
-            BigInteger.class.getCanonicalName());
-    
-    private static final Set DATE_TIME_CLASSES = Java8Compat.setOf(
-            OffsetDateTime.class.getCanonicalName(),
-            LocalDate.class.getCanonicalName());
-    
+            Integer.class.getCanonicalName(), Long.class.getCanonicalName(), BigInteger.class.getCanonicalName());
+
+    private static final Set DATE_TIME_CLASSES =
+            Java8Compat.setOf(OffsetDateTime.class.getCanonicalName(), LocalDate.class.getCanonicalName());
+
     // VisibleForTesting
     public static boolean matchPossible(JavaType type, String json) {
         // situations we want to AVOID that can happen with Jackson ObjectMapper:
@@ -399,7 +390,7 @@ public static boolean matchPossible(JavaType type, String json) {
         // * non-double-quoted json string considered as valid string
         // * json numeric can be parsed as a Boolean
         // * double-quoted numerics can be parsed as numerics
-        
+
         // We make important assumptions about matching json with types
         if (typeIs(type, String.class) || typeIs(type, BigIntegerString.class) || typeIs(type, BigDecimalString.class)) {
             // string must be double quoted
@@ -416,7 +407,7 @@ public static boolean matchPossible(JavaType type, String json) {
             return true;
         }
     }
-    
+
     private static boolean isDoubleQuoted(String s) {
         return s.length() >= 2 && s.startsWith("\"") && s.endsWith("\"");
     }
@@ -452,7 +443,7 @@ public static  List> applyMatchPreferences(List> matches, S
             for (Match match : matches) {
                 match.countFields();
             }
-            
+
             return matches.stream()
                     .sorted(Comparator.reverseOrder()) // Best candidates first (highest scores)
                     .collect(Collectors.toList());
@@ -462,34 +453,37 @@ public static  List> applyMatchPreferences(List> matches, S
     }
 
     private static  List> filter(List> matches, Class filterByClass) {
-        return matches //
-                .stream() //
-                .filter(x -> x.typeReference.typeReference().getType().getTypeName().equals(filterByClass.getCanonicalName())) //
+        return matches.stream()
+                .filter(x -> x.typeReference.typeReference().getType().getTypeName().equals(filterByClass.getCanonicalName()))
                 .collect(Collectors.toList());
     }
-    
+
     private static  boolean allDateTime(List> matches) {
-        return matches.stream().allMatch(x -> DATE_TIME_CLASSES.contains(x.typeReference.typeReference().getType().getTypeName()));
+        return matches.stream()
+                .allMatch(x -> DATE_TIME_CLASSES.contains(
+                        x.typeReference.typeReference().getType().getTypeName()));
     }
-    
+
     private static  boolean allNumeric(List> matches) {
-        return matches.stream().allMatch(x -> NUMERIC_CLASSES.contains(x.typeReference.typeReference().getType().getTypeName()));
+        return matches.stream()
+                .allMatch(x -> NUMERIC_CLASSES.contains(
+                        x.typeReference.typeReference().getType().getTypeName()));
     }
-    
+
     private static  List> decimalMatches(List> matches) {
-        return matches //
-                .stream() //
-                .filter(x -> DECIMAL_CLASSES.contains(x.typeReference.typeReference().getType().getTypeName())) //
+        return matches.stream()
+                .filter(x -> DECIMAL_CLASSES.contains(
+                        x.typeReference.typeReference().getType().getTypeName()))
                 .collect(Collectors.toList());
     }
-    
+
     private static  List> integerMatches(List> matches) {
-        return matches //
-                .stream() //
-                .filter(x -> INTEGER_CLASSES.contains(x.typeReference.typeReference().getType().getTypeName())) //
+        return matches.stream()
+                .filter(x -> INTEGER_CLASSES.contains(
+                        x.typeReference.typeReference().getType().getTypeName()))
                 .collect(Collectors.toList());
     }
-    
+
     private static boolean isNumeric(String s) {
         try {
             Double.parseDouble(s);
@@ -498,23 +492,23 @@ private static boolean isNumeric(String s) {
             return false;
         }
     }
-    
+
     private static boolean typeIs(JavaType type, Class cls) {
         return type.getRawClass().equals(cls);
     }
-    
+
     private static  String typeNames(List> matches) {
-        return "[" + matches
-                .stream()
-                .map(x -> x.typeReference.typeReference().getType().getTypeName())
-                .collect(Collectors.joining(", ")) + "]";
+        return "["
+                + matches.stream()
+                        .map(x -> x.typeReference.typeReference().getType().getTypeName())
+                        .collect(Collectors.joining(", "))
+                + "]";
     }
-    
+
     private static String typeReferenceNames(List list) {
-        return "[" + list
-                .stream()
-                .map(x -> x.typeReference().getType().getTypeName())
-                .collect(Collectors.joining(", ")) + "]";
+        return "["
+                + list.stream().map(x -> x.typeReference().getType().getTypeName()).collect(Collectors.joining(", "))
+                + "]";
     }
 
     private static  T newInstance(Class cls, Object parameter) {
@@ -522,10 +516,13 @@ private static  T newInstance(Class cls, Object parameter) {
             Constructor con = cls.getDeclaredConstructor(TypedObject.class);
             con.setAccessible(true);
             return con.newInstance(parameter);
-        } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
-                | NoSuchMethodException | SecurityException e) {
+        } catch (InstantiationException
+                | IllegalAccessException
+                | IllegalArgumentException
+                | InvocationTargetException
+                | NoSuchMethodException
+                | SecurityException e) {
             throw new RuntimeException(e);
         }
     }
-    
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/google/genai/gaos/utils/OpenapiJacksonModule.java b/src/main/java/com/google/genai/gaos/utils/OpenapiJacksonModule.java
index 1a7e74a8a67..7ebcd4684fc 100644
--- a/src/main/java/com/google/genai/gaos/utils/OpenapiJacksonModule.java
+++ b/src/main/java/com/google/genai/gaos/utils/OpenapiJacksonModule.java
@@ -72,10 +72,10 @@ public void setupModule(SetupContext context) {
         if (context.getOwner() instanceof ObjectMapper) {
             ObjectMapper mapper = (ObjectMapper) context.getOwner();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
-                  .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
-                  .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
-                  .enable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)
-                  .setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
+                    .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
+                    .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
+                    .enable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)
+                    .setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
         }
     }
 }
diff --git a/src/main/java/com/google/genai/gaos/utils/Options.java b/src/main/java/com/google/genai/gaos/utils/Options.java
index 7cc9e8fc0ad..e9bccd4f76c 100644
--- a/src/main/java/com/google/genai/gaos/utils/Options.java
+++ b/src/main/java/com/google/genai/gaos/utils/Options.java
@@ -19,8 +19,8 @@
  */
 package com.google.genai.gaos.utils;
 
-import java.util.Optional;
 import java.util.List;
+import java.util.Optional;
 
 public class Options {
 
@@ -45,11 +45,11 @@ public final void validate(List