Skip to content

Commit 91c762f

Browse files
speedstorm1copybara-github
authored andcommitted
chore: Support root object conversion for Go SDK. Add response-level root object access to all SDK converters.
PiperOrigin-RevId: 861371753
1 parent bbbac50 commit 91c762f

10 files changed

Lines changed: 1022 additions & 338 deletions

src/main/java/com/google/genai/AsyncBatches.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public AsyncBatches(ApiClient apiClient) {
4949

5050
CompletableFuture<BatchJob> privateCreate(
5151
String model, BatchJobSource src, CreateBatchJobConfig config) {
52+
5253
BuiltRequest builtRequest = batches.buildRequestForPrivateCreate(model, src, config);
5354
return this.apiClient
5455
.asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
@@ -62,6 +63,7 @@ CompletableFuture<BatchJob> privateCreate(
6263

6364
CompletableFuture<BatchJob> privateCreateEmbeddings(
6465
String model, EmbeddingsBatchJobSource src, CreateEmbeddingsBatchJobConfig config) {
66+
6567
BuiltRequest builtRequest = batches.buildRequestForPrivateCreateEmbeddings(model, src, config);
6668
return this.apiClient
6769
.asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
@@ -83,6 +85,7 @@ CompletableFuture<BatchJob> privateCreateEmbeddings(
8385
* @return A {@link BatchJob} object that contains the info of the batch job.
8486
*/
8587
public CompletableFuture<BatchJob> get(String name, GetBatchJobConfig config) {
88+
8689
BuiltRequest builtRequest = batches.buildRequestForGet(name, config);
8790
return this.apiClient
8891
.asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
@@ -103,6 +106,7 @@ public CompletableFuture<BatchJob> get(String name, GetBatchJobConfig config) {
103106
* @param config A {@link CancelBatchJobConfig} for configuring the cancel request.
104107
*/
105108
public CompletableFuture<Void> cancel(String name, CancelBatchJobConfig config) {
109+
106110
BuiltRequest builtRequest = batches.buildRequestForCancel(name, config);
107111
return this.apiClient
108112
.asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
@@ -113,6 +117,7 @@ public CompletableFuture<Void> cancel(String name, CancelBatchJobConfig config)
113117
}
114118

115119
CompletableFuture<ListBatchJobsResponse> privateList(ListBatchJobsConfig config) {
120+
116121
BuiltRequest builtRequest = batches.buildRequestForPrivateList(config);
117122
return this.apiClient
118123
.asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
@@ -133,6 +138,7 @@ CompletableFuture<ListBatchJobsResponse> privateList(ListBatchJobsConfig config)
133138
* @param config A {@link DeleteBatchJobConfig} for configuring the delete request.
134139
*/
135140
public CompletableFuture<DeleteResourceJob> delete(String name, DeleteBatchJobConfig config) {
141+
136142
BuiltRequest builtRequest = batches.buildRequestForDelete(name, config);
137143
return this.apiClient
138144
.asyncRequest(

src/main/java/com/google/genai/AsyncCaches.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public AsyncCaches(ApiClient apiClient) {
5252
* @return A {@link CachedContent} object that contains the info of the created resource.
5353
*/
5454
public CompletableFuture<CachedContent> create(String model, CreateCachedContentConfig config) {
55+
5556
BuiltRequest builtRequest = caches.buildRequestForCreate(model, config);
5657
return this.apiClient
5758
.asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
@@ -71,6 +72,7 @@ public CompletableFuture<CachedContent> create(String model, CreateCachedContent
7172
* @return A {@link CachedContent} object that contains the info of the cached content.
7273
*/
7374
public CompletableFuture<CachedContent> get(String name, GetCachedContentConfig config) {
75+
7476
BuiltRequest builtRequest = caches.buildRequestForGet(name, config);
7577
return this.apiClient
7678
.asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
@@ -90,6 +92,7 @@ public CompletableFuture<CachedContent> get(String name, GetCachedContentConfig
9092
*/
9193
public CompletableFuture<DeleteCachedContentResponse> delete(
9294
String name, DeleteCachedContentConfig config) {
95+
9396
BuiltRequest builtRequest = caches.buildRequestForDelete(name, config);
9497
return this.apiClient
9598
.asyncRequest(
@@ -110,6 +113,7 @@ public CompletableFuture<DeleteCachedContentResponse> delete(
110113
* @return A {@link CachedContent} object that contains the info of the updated resource.
111114
*/
112115
public CompletableFuture<CachedContent> update(String name, UpdateCachedContentConfig config) {
116+
113117
BuiltRequest builtRequest = caches.buildRequestForUpdate(name, config);
114118
return this.apiClient
115119
.asyncRequest("patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
@@ -122,6 +126,7 @@ public CompletableFuture<CachedContent> update(String name, UpdateCachedContentC
122126
}
123127

124128
CompletableFuture<ListCachedContentsResponse> privateList(ListCachedContentsConfig config) {
129+
125130
BuiltRequest builtRequest = caches.buildRequestForPrivateList(config);
126131
return this.apiClient
127132
.asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())

src/main/java/com/google/genai/AsyncDocuments.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public AsyncDocuments(ApiClient apiClient) {
4242
}
4343

4444
public CompletableFuture<Document> get(String name, GetDocumentConfig config) {
45+
4546
BuiltRequest builtRequest = documents.buildRequestForGet(name, config);
4647
return this.apiClient
4748
.asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
@@ -54,6 +55,7 @@ public CompletableFuture<Document> get(String name, GetDocumentConfig config) {
5455
}
5556

5657
public CompletableFuture<Void> delete(String name, DeleteDocumentConfig config) {
58+
5759
BuiltRequest builtRequest = documents.buildRequestForDelete(name, config);
5860
return this.apiClient
5961
.asyncRequest(
@@ -65,6 +67,7 @@ public CompletableFuture<Void> delete(String name, DeleteDocumentConfig config)
6567
}
6668

6769
CompletableFuture<ListDocumentsResponse> privateList(String parent, ListDocumentsConfig config) {
70+
6871
BuiltRequest builtRequest = documents.buildRequestForPrivateList(parent, config);
6972
return this.apiClient
7073
.asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())

src/main/java/com/google/genai/AsyncFileSearchStores.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public AsyncFileSearchStores(ApiClient apiClient) {
5959
}
6060

6161
public CompletableFuture<FileSearchStore> create(CreateFileSearchStoreConfig config) {
62+
6263
BuiltRequest builtRequest = fileSearchStores.buildRequestForCreate(config);
6364
return this.apiClient
6465
.asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
@@ -71,6 +72,7 @@ public CompletableFuture<FileSearchStore> create(CreateFileSearchStoreConfig con
7172
}
7273

7374
public CompletableFuture<FileSearchStore> get(String name, GetFileSearchStoreConfig config) {
75+
7476
BuiltRequest builtRequest = fileSearchStores.buildRequestForGet(name, config);
7577
return this.apiClient
7678
.asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
@@ -83,6 +85,7 @@ public CompletableFuture<FileSearchStore> get(String name, GetFileSearchStoreCon
8385
}
8486

8587
public CompletableFuture<Void> delete(String name, DeleteFileSearchStoreConfig config) {
88+
8689
BuiltRequest builtRequest = fileSearchStores.buildRequestForDelete(name, config);
8790
return this.apiClient
8891
.asyncRequest(
@@ -94,6 +97,7 @@ public CompletableFuture<Void> delete(String name, DeleteFileSearchStoreConfig c
9497
}
9598

9699
CompletableFuture<ListFileSearchStoresResponse> privateList(ListFileSearchStoresConfig config) {
100+
97101
BuiltRequest builtRequest = fileSearchStores.buildRequestForPrivateList(config);
98102
return this.apiClient
99103
.asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
@@ -107,6 +111,7 @@ CompletableFuture<ListFileSearchStoresResponse> privateList(ListFileSearchStores
107111

108112
CompletableFuture<UploadToFileSearchStoreResumableResponse> privateUploadToFileSearchStore(
109113
String fileSearchStoreName, UploadToFileSearchStoreConfig config) {
114+
110115
BuiltRequest builtRequest =
111116
fileSearchStores.buildRequestForPrivateUploadToFileSearchStore(fileSearchStoreName, config);
112117
return this.apiClient
@@ -122,6 +127,7 @@ CompletableFuture<UploadToFileSearchStoreResumableResponse> privateUploadToFileS
122127

123128
public CompletableFuture<ImportFileOperation> importFile(
124129
String fileSearchStoreName, String fileName, ImportFileConfig config) {
130+
125131
BuiltRequest builtRequest =
126132
fileSearchStores.buildRequestForImportFile(fileSearchStoreName, fileName, config);
127133
return this.apiClient

src/main/java/com/google/genai/AsyncFiles.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public AsyncFiles(ApiClient apiClient) {
5050
}
5151

5252
CompletableFuture<ListFilesResponse> privateList(ListFilesConfig config) {
53+
5354
BuiltRequest builtRequest = files.buildRequestForPrivateList(config);
5455
return this.apiClient
5556
.asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
@@ -62,6 +63,7 @@ CompletableFuture<ListFilesResponse> privateList(ListFilesConfig config) {
6263
}
6364

6465
CompletableFuture<CreateFileResponse> privateCreate(File file, CreateFileConfig config) {
66+
6567
BuiltRequest builtRequest = files.buildRequestForPrivateCreate(file, config);
6668
return this.apiClient
6769
.asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
@@ -81,6 +83,7 @@ CompletableFuture<CreateFileResponse> privateCreate(File file, CreateFileConfig
8183
* @return A File object representing the file.
8284
*/
8385
public CompletableFuture<File> get(String name, GetFileConfig config) {
86+
8487
BuiltRequest builtRequest = files.buildRequestForGet(name, config);
8588
return this.apiClient
8689
.asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
@@ -100,6 +103,7 @@ public CompletableFuture<File> get(String name, GetFileConfig config) {
100103
* @return The DeleteFileResponse, the response for the delete method.
101104
*/
102105
public CompletableFuture<DeleteFileResponse> delete(String name, DeleteFileConfig config) {
106+
103107
BuiltRequest builtRequest = files.buildRequestForDelete(name, config);
104108
return this.apiClient
105109
.asyncRequest(

0 commit comments

Comments
 (0)