|
47 | 47 | import com.google.genai.types.GenerateVideosOperation; |
48 | 48 | import com.google.genai.types.GenerateVideosParameters; |
49 | 49 | import com.google.genai.types.GeneratedImage; |
| 50 | +import com.google.genai.types.HttpOptions; |
50 | 51 | import com.google.genai.types.Image; |
51 | 52 | import com.google.genai.types.Part; |
52 | 53 | import com.google.genai.types.ReferenceImage; |
@@ -4116,8 +4117,13 @@ private GenerateContentResponse privateGenerateContent( |
4116 | 4117 | // TODO: Remove the hack that removes config. |
4117 | 4118 | body.remove("config"); |
4118 | 4119 |
|
| 4120 | + HttpOptions httpOptions = null; |
| 4121 | + if (config != null) { |
| 4122 | + httpOptions = config.httpOptions().orElse(null); |
| 4123 | + } |
| 4124 | + |
4119 | 4125 | try (ApiResponse response = |
4120 | | - this.apiClient.request("post", path, JsonSerializable.toJsonString(body))) { |
| 4126 | + this.apiClient.request("post", path, JsonSerializable.toJsonString(body), httpOptions)) { |
4121 | 4127 | HttpEntity entity = response.getEntity(); |
4122 | 4128 | String responseString; |
4123 | 4129 | try { |
@@ -4167,8 +4173,13 @@ private ResponseStream<GenerateContentResponse> privateGenerateContentStream( |
4167 | 4173 | // TODO: Remove the hack that removes config. |
4168 | 4174 | body.remove("config"); |
4169 | 4175 |
|
| 4176 | + HttpOptions httpOptions = null; |
| 4177 | + if (config != null) { |
| 4178 | + httpOptions = config.httpOptions().orElse(null); |
| 4179 | + } |
| 4180 | + |
4170 | 4181 | ApiResponse response = |
4171 | | - this.apiClient.request("post", path, JsonSerializable.toJsonString(body)); |
| 4182 | + this.apiClient.request("post", path, JsonSerializable.toJsonString(body), httpOptions); |
4172 | 4183 | String converterName; |
4173 | 4184 | if (this.apiClient.vertexAI()) { |
4174 | 4185 | converterName = "generateContentResponseFromVertex"; |
@@ -4211,8 +4222,13 @@ private EmbedContentResponse privateEmbedContent( |
4211 | 4222 | // TODO: Remove the hack that removes config. |
4212 | 4223 | body.remove("config"); |
4213 | 4224 |
|
| 4225 | + HttpOptions httpOptions = null; |
| 4226 | + if (config != null) { |
| 4227 | + httpOptions = config.httpOptions().orElse(null); |
| 4228 | + } |
| 4229 | + |
4214 | 4230 | try (ApiResponse response = |
4215 | | - this.apiClient.request("post", path, JsonSerializable.toJsonString(body))) { |
| 4231 | + this.apiClient.request("post", path, JsonSerializable.toJsonString(body), httpOptions)) { |
4216 | 4232 | HttpEntity entity = response.getEntity(); |
4217 | 4233 | String responseString; |
4218 | 4234 | try { |
@@ -4262,8 +4278,13 @@ private GenerateImagesResponse privateGenerateImages( |
4262 | 4278 | // TODO: Remove the hack that removes config. |
4263 | 4279 | body.remove("config"); |
4264 | 4280 |
|
| 4281 | + HttpOptions httpOptions = null; |
| 4282 | + if (config != null) { |
| 4283 | + httpOptions = config.httpOptions().orElse(null); |
| 4284 | + } |
| 4285 | + |
4265 | 4286 | try (ApiResponse response = |
4266 | | - this.apiClient.request("post", path, JsonSerializable.toJsonString(body))) { |
| 4287 | + this.apiClient.request("post", path, JsonSerializable.toJsonString(body), httpOptions)) { |
4267 | 4288 | HttpEntity entity = response.getEntity(); |
4268 | 4289 | String responseString; |
4269 | 4290 | try { |
@@ -4319,8 +4340,13 @@ private EditImageResponse privateEditImage( |
4319 | 4340 | // TODO: Remove the hack that removes config. |
4320 | 4341 | body.remove("config"); |
4321 | 4342 |
|
| 4343 | + HttpOptions httpOptions = null; |
| 4344 | + if (config != null) { |
| 4345 | + httpOptions = config.httpOptions().orElse(null); |
| 4346 | + } |
| 4347 | + |
4322 | 4348 | try (ApiResponse response = |
4323 | | - this.apiClient.request("post", path, JsonSerializable.toJsonString(body))) { |
| 4349 | + this.apiClient.request("post", path, JsonSerializable.toJsonString(body), httpOptions)) { |
4324 | 4350 | HttpEntity entity = response.getEntity(); |
4325 | 4351 | String responseString; |
4326 | 4352 | try { |
@@ -4374,8 +4400,13 @@ private UpscaleImageResponse privateUpscaleImage( |
4374 | 4400 | // TODO: Remove the hack that removes config. |
4375 | 4401 | body.remove("config"); |
4376 | 4402 |
|
| 4403 | + HttpOptions httpOptions = null; |
| 4404 | + if (config != null) { |
| 4405 | + httpOptions = config.httpOptions().orElse(null); |
| 4406 | + } |
| 4407 | + |
4377 | 4408 | try (ApiResponse response = |
4378 | | - this.apiClient.request("post", path, JsonSerializable.toJsonString(body))) { |
| 4409 | + this.apiClient.request("post", path, JsonSerializable.toJsonString(body), httpOptions)) { |
4379 | 4410 | HttpEntity entity = response.getEntity(); |
4380 | 4411 | String responseString; |
4381 | 4412 | try { |
@@ -4426,8 +4457,13 @@ public CountTokensResponse countTokens( |
4426 | 4457 | // TODO: Remove the hack that removes config. |
4427 | 4458 | body.remove("config"); |
4428 | 4459 |
|
| 4460 | + HttpOptions httpOptions = null; |
| 4461 | + if (config != null) { |
| 4462 | + httpOptions = config.httpOptions().orElse(null); |
| 4463 | + } |
| 4464 | + |
4429 | 4465 | try (ApiResponse response = |
4430 | | - this.apiClient.request("post", path, JsonSerializable.toJsonString(body))) { |
| 4466 | + this.apiClient.request("post", path, JsonSerializable.toJsonString(body), httpOptions)) { |
4431 | 4467 | HttpEntity entity = response.getEntity(); |
4432 | 4468 | String responseString; |
4433 | 4469 | try { |
@@ -4477,8 +4513,13 @@ public ComputeTokensResponse computeTokens( |
4477 | 4513 | // TODO: Remove the hack that removes config. |
4478 | 4514 | body.remove("config"); |
4479 | 4515 |
|
| 4516 | + HttpOptions httpOptions = null; |
| 4517 | + if (config != null) { |
| 4518 | + httpOptions = config.httpOptions().orElse(null); |
| 4519 | + } |
| 4520 | + |
4480 | 4521 | try (ApiResponse response = |
4481 | | - this.apiClient.request("post", path, JsonSerializable.toJsonString(body))) { |
| 4522 | + this.apiClient.request("post", path, JsonSerializable.toJsonString(body), httpOptions)) { |
4482 | 4523 | HttpEntity entity = response.getEntity(); |
4483 | 4524 | String responseString; |
4484 | 4525 | try { |
@@ -4545,8 +4586,13 @@ public GenerateVideosOperation generateVideos( |
4545 | 4586 | // TODO: Remove the hack that removes config. |
4546 | 4587 | body.remove("config"); |
4547 | 4588 |
|
| 4589 | + HttpOptions httpOptions = null; |
| 4590 | + if (config != null) { |
| 4591 | + httpOptions = config.httpOptions().orElse(null); |
| 4592 | + } |
| 4593 | + |
4548 | 4594 | try (ApiResponse response = |
4549 | | - this.apiClient.request("post", path, JsonSerializable.toJsonString(body))) { |
| 4595 | + this.apiClient.request("post", path, JsonSerializable.toJsonString(body), httpOptions)) { |
4550 | 4596 | HttpEntity entity = response.getEntity(); |
4551 | 4597 | String responseString; |
4552 | 4598 | try { |
|
0 commit comments