|
| 1 | +/* |
| 2 | + * Copyright 2025 Google LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +// Auto-generated code. Do not edit. |
| 18 | + |
| 19 | +package com.google.cloud.vertexai.genai; |
| 20 | + |
| 21 | +import com.google.cloud.vertexai.genai.types.AssembleDatasetConfig; |
| 22 | +import com.google.cloud.vertexai.genai.types.CreateMultimodalDatasetConfig; |
| 23 | +import com.google.cloud.vertexai.genai.types.GeminiRequestReadConfig; |
| 24 | +import com.google.cloud.vertexai.genai.types.GetMultimodalDatasetOperationConfig; |
| 25 | +import com.google.cloud.vertexai.genai.types.ListMultimodalDatasetsConfig; |
| 26 | +import com.google.cloud.vertexai.genai.types.ListMultimodalDatasetsResponse; |
| 27 | +import com.google.cloud.vertexai.genai.types.MultimodalDataset; |
| 28 | +import com.google.cloud.vertexai.genai.types.MultimodalDatasetOperation; |
| 29 | +import com.google.cloud.vertexai.genai.types.SchemaTablesDatasetMetadata; |
| 30 | +import com.google.cloud.vertexai.genai.types.UpdateMultimodalDatasetConfig; |
| 31 | +import com.google.cloud.vertexai.genai.types.VertexBaseConfig; |
| 32 | +import com.google.genai.ApiClient; |
| 33 | +import com.google.genai.ApiResponse; |
| 34 | +import com.google.genai.Common.BuiltRequest; |
| 35 | +import com.google.genai.types.EncryptionSpec; |
| 36 | +import java.util.concurrent.CompletableFuture; |
| 37 | + |
| 38 | +/** Async module of {@link Datasets} */ |
| 39 | +public final class AsyncDatasets { |
| 40 | + |
| 41 | + Datasets datasets; |
| 42 | + ApiClient apiClient; |
| 43 | + |
| 44 | + public AsyncDatasets(ApiClient apiClient) { |
| 45 | + this.apiClient = apiClient; |
| 46 | + this.datasets = new Datasets(apiClient); |
| 47 | + } |
| 48 | + |
| 49 | + CompletableFuture<MultimodalDatasetOperation> privateAssembleMultimodalDataset( |
| 50 | + String name, GeminiRequestReadConfig geminiRequestReadConfig, AssembleDatasetConfig config) { |
| 51 | + BuiltRequest builtRequest = |
| 52 | + datasets.buildRequestForPrivateAssembleMultimodalDataset( |
| 53 | + name, geminiRequestReadConfig, config); |
| 54 | + return this.apiClient |
| 55 | + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) |
| 56 | + .thenApplyAsync( |
| 57 | + response -> { |
| 58 | + try (ApiResponse res = response) { |
| 59 | + return datasets.processResponseForPrivateAssembleMultimodalDataset(res, config); |
| 60 | + } |
| 61 | + }); |
| 62 | + } |
| 63 | + |
| 64 | + CompletableFuture<MultimodalDatasetOperation> privateCreateMultimodalDataset( |
| 65 | + String name, |
| 66 | + String displayName, |
| 67 | + String metadataSchemaUri, |
| 68 | + SchemaTablesDatasetMetadata metadata, |
| 69 | + String description, |
| 70 | + EncryptionSpec encryptionSpec, |
| 71 | + CreateMultimodalDatasetConfig config) { |
| 72 | + BuiltRequest builtRequest = |
| 73 | + datasets.buildRequestForPrivateCreateMultimodalDataset( |
| 74 | + name, displayName, metadataSchemaUri, metadata, description, encryptionSpec, config); |
| 75 | + return this.apiClient |
| 76 | + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) |
| 77 | + .thenApplyAsync( |
| 78 | + response -> { |
| 79 | + try (ApiResponse res = response) { |
| 80 | + return datasets.processResponseForPrivateCreateMultimodalDataset(res, config); |
| 81 | + } |
| 82 | + }); |
| 83 | + } |
| 84 | + |
| 85 | + CompletableFuture<MultimodalDatasetOperation> privateDeleteMultimodalDataset( |
| 86 | + String name, VertexBaseConfig config) { |
| 87 | + BuiltRequest builtRequest = |
| 88 | + datasets.buildRequestForPrivateDeleteMultimodalDataset(name, config); |
| 89 | + return this.apiClient |
| 90 | + .asyncRequest( |
| 91 | + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) |
| 92 | + .thenApplyAsync( |
| 93 | + response -> { |
| 94 | + try (ApiResponse res = response) { |
| 95 | + return datasets.processResponseForPrivateDeleteMultimodalDataset(res, config); |
| 96 | + } |
| 97 | + }); |
| 98 | + } |
| 99 | + |
| 100 | + CompletableFuture<MultimodalDataset> privateGetMultimodalDataset( |
| 101 | + String name, VertexBaseConfig config) { |
| 102 | + BuiltRequest builtRequest = datasets.buildRequestForPrivateGetMultimodalDataset(name, config); |
| 103 | + return this.apiClient |
| 104 | + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) |
| 105 | + .thenApplyAsync( |
| 106 | + response -> { |
| 107 | + try (ApiResponse res = response) { |
| 108 | + return datasets.processResponseForPrivateGetMultimodalDataset(res, config); |
| 109 | + } |
| 110 | + }); |
| 111 | + } |
| 112 | + |
| 113 | + CompletableFuture<MultimodalDatasetOperation> privateGetMultimodalDatasetOperation( |
| 114 | + String datasetId, String operationId, GetMultimodalDatasetOperationConfig config) { |
| 115 | + BuiltRequest builtRequest = |
| 116 | + datasets.buildRequestForPrivateGetMultimodalDatasetOperation( |
| 117 | + datasetId, operationId, config); |
| 118 | + return this.apiClient |
| 119 | + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) |
| 120 | + .thenApplyAsync( |
| 121 | + response -> { |
| 122 | + try (ApiResponse res = response) { |
| 123 | + return datasets.processResponseForPrivateGetMultimodalDatasetOperation(res, config); |
| 124 | + } |
| 125 | + }); |
| 126 | + } |
| 127 | + |
| 128 | + CompletableFuture<ListMultimodalDatasetsResponse> privateListMultimodalDatasets( |
| 129 | + ListMultimodalDatasetsConfig config) { |
| 130 | + BuiltRequest builtRequest = datasets.buildRequestForPrivateListMultimodalDatasets(config); |
| 131 | + return this.apiClient |
| 132 | + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) |
| 133 | + .thenApplyAsync( |
| 134 | + response -> { |
| 135 | + try (ApiResponse res = response) { |
| 136 | + return datasets.processResponseForPrivateListMultimodalDatasets(res, config); |
| 137 | + } |
| 138 | + }); |
| 139 | + } |
| 140 | + |
| 141 | + CompletableFuture<MultimodalDataset> privateUpdateMultimodalDataset( |
| 142 | + String name, |
| 143 | + String displayName, |
| 144 | + SchemaTablesDatasetMetadata metadata, |
| 145 | + String description, |
| 146 | + EncryptionSpec encryptionSpec, |
| 147 | + UpdateMultimodalDatasetConfig config) { |
| 148 | + BuiltRequest builtRequest = |
| 149 | + datasets.buildRequestForPrivateUpdateMultimodalDataset( |
| 150 | + name, displayName, metadata, description, encryptionSpec, config); |
| 151 | + return this.apiClient |
| 152 | + .asyncRequest("patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) |
| 153 | + .thenApplyAsync( |
| 154 | + response -> { |
| 155 | + try (ApiResponse res = response) { |
| 156 | + return datasets.processResponseForPrivateUpdateMultimodalDataset(res, config); |
| 157 | + } |
| 158 | + }); |
| 159 | + } |
| 160 | +} |
0 commit comments