|
24 | 24 | import com.google.api.gax.grpc.GrpcStubCallableFactory; |
25 | 25 | import com.google.api.gax.rpc.ClientContext; |
26 | 26 | import com.google.api.gax.rpc.OperationCallable; |
| 27 | +import com.google.api.gax.rpc.RequestParamsExtractor; |
27 | 28 | import com.google.api.gax.rpc.UnaryCallable; |
28 | 29 | import com.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest; |
29 | 30 | import com.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest; |
|
38 | 39 | import com.google.cloud.dialogflow.v2.ListEntityTypesRequest; |
39 | 40 | import com.google.cloud.dialogflow.v2.ListEntityTypesResponse; |
40 | 41 | import com.google.cloud.dialogflow.v2.UpdateEntityTypeRequest; |
| 42 | +import com.google.common.collect.ImmutableMap; |
41 | 43 | import com.google.longrunning.Operation; |
42 | 44 | import com.google.longrunning.stub.GrpcOperationsStub; |
43 | 45 | import com.google.protobuf.Empty; |
44 | 46 | import com.google.protobuf.Struct; |
45 | 47 | import io.grpc.MethodDescriptor; |
46 | 48 | import io.grpc.protobuf.ProtoUtils; |
47 | 49 | import java.io.IOException; |
| 50 | +import java.util.Map; |
48 | 51 | import java.util.concurrent.TimeUnit; |
49 | 52 | import javax.annotation.Generated; |
50 | 53 |
|
@@ -224,44 +227,135 @@ protected GrpcEntityTypesStub( |
224 | 227 | listEntityTypesTransportSettings = |
225 | 228 | GrpcCallSettings.<ListEntityTypesRequest, ListEntityTypesResponse>newBuilder() |
226 | 229 | .setMethodDescriptor(listEntityTypesMethodDescriptor) |
| 230 | + .setParamsExtractor( |
| 231 | + new RequestParamsExtractor<ListEntityTypesRequest>() { |
| 232 | + @Override |
| 233 | + public Map<String, String> extract(ListEntityTypesRequest request) { |
| 234 | + ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); |
| 235 | + params.put("parent", String.valueOf(request.getParent())); |
| 236 | + return params.build(); |
| 237 | + } |
| 238 | + }) |
227 | 239 | .build(); |
228 | 240 | GrpcCallSettings<GetEntityTypeRequest, EntityType> getEntityTypeTransportSettings = |
229 | 241 | GrpcCallSettings.<GetEntityTypeRequest, EntityType>newBuilder() |
230 | 242 | .setMethodDescriptor(getEntityTypeMethodDescriptor) |
| 243 | + .setParamsExtractor( |
| 244 | + new RequestParamsExtractor<GetEntityTypeRequest>() { |
| 245 | + @Override |
| 246 | + public Map<String, String> extract(GetEntityTypeRequest request) { |
| 247 | + ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); |
| 248 | + params.put("name", String.valueOf(request.getName())); |
| 249 | + return params.build(); |
| 250 | + } |
| 251 | + }) |
231 | 252 | .build(); |
232 | 253 | GrpcCallSettings<CreateEntityTypeRequest, EntityType> createEntityTypeTransportSettings = |
233 | 254 | GrpcCallSettings.<CreateEntityTypeRequest, EntityType>newBuilder() |
234 | 255 | .setMethodDescriptor(createEntityTypeMethodDescriptor) |
| 256 | + .setParamsExtractor( |
| 257 | + new RequestParamsExtractor<CreateEntityTypeRequest>() { |
| 258 | + @Override |
| 259 | + public Map<String, String> extract(CreateEntityTypeRequest request) { |
| 260 | + ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); |
| 261 | + params.put("parent", String.valueOf(request.getParent())); |
| 262 | + return params.build(); |
| 263 | + } |
| 264 | + }) |
235 | 265 | .build(); |
236 | 266 | GrpcCallSettings<UpdateEntityTypeRequest, EntityType> updateEntityTypeTransportSettings = |
237 | 267 | GrpcCallSettings.<UpdateEntityTypeRequest, EntityType>newBuilder() |
238 | 268 | .setMethodDescriptor(updateEntityTypeMethodDescriptor) |
| 269 | + .setParamsExtractor( |
| 270 | + new RequestParamsExtractor<UpdateEntityTypeRequest>() { |
| 271 | + @Override |
| 272 | + public Map<String, String> extract(UpdateEntityTypeRequest request) { |
| 273 | + ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); |
| 274 | + params.put( |
| 275 | + "entity_type.name", String.valueOf(request.getEntityType().getName())); |
| 276 | + return params.build(); |
| 277 | + } |
| 278 | + }) |
239 | 279 | .build(); |
240 | 280 | GrpcCallSettings<DeleteEntityTypeRequest, Empty> deleteEntityTypeTransportSettings = |
241 | 281 | GrpcCallSettings.<DeleteEntityTypeRequest, Empty>newBuilder() |
242 | 282 | .setMethodDescriptor(deleteEntityTypeMethodDescriptor) |
| 283 | + .setParamsExtractor( |
| 284 | + new RequestParamsExtractor<DeleteEntityTypeRequest>() { |
| 285 | + @Override |
| 286 | + public Map<String, String> extract(DeleteEntityTypeRequest request) { |
| 287 | + ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); |
| 288 | + params.put("name", String.valueOf(request.getName())); |
| 289 | + return params.build(); |
| 290 | + } |
| 291 | + }) |
243 | 292 | .build(); |
244 | 293 | GrpcCallSettings<BatchUpdateEntityTypesRequest, Operation> |
245 | 294 | batchUpdateEntityTypesTransportSettings = |
246 | 295 | GrpcCallSettings.<BatchUpdateEntityTypesRequest, Operation>newBuilder() |
247 | 296 | .setMethodDescriptor(batchUpdateEntityTypesMethodDescriptor) |
| 297 | + .setParamsExtractor( |
| 298 | + new RequestParamsExtractor<BatchUpdateEntityTypesRequest>() { |
| 299 | + @Override |
| 300 | + public Map<String, String> extract(BatchUpdateEntityTypesRequest request) { |
| 301 | + ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); |
| 302 | + params.put("parent", String.valueOf(request.getParent())); |
| 303 | + return params.build(); |
| 304 | + } |
| 305 | + }) |
248 | 306 | .build(); |
249 | 307 | GrpcCallSettings<BatchDeleteEntityTypesRequest, Operation> |
250 | 308 | batchDeleteEntityTypesTransportSettings = |
251 | 309 | GrpcCallSettings.<BatchDeleteEntityTypesRequest, Operation>newBuilder() |
252 | 310 | .setMethodDescriptor(batchDeleteEntityTypesMethodDescriptor) |
| 311 | + .setParamsExtractor( |
| 312 | + new RequestParamsExtractor<BatchDeleteEntityTypesRequest>() { |
| 313 | + @Override |
| 314 | + public Map<String, String> extract(BatchDeleteEntityTypesRequest request) { |
| 315 | + ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); |
| 316 | + params.put("parent", String.valueOf(request.getParent())); |
| 317 | + return params.build(); |
| 318 | + } |
| 319 | + }) |
253 | 320 | .build(); |
254 | 321 | GrpcCallSettings<BatchCreateEntitiesRequest, Operation> batchCreateEntitiesTransportSettings = |
255 | 322 | GrpcCallSettings.<BatchCreateEntitiesRequest, Operation>newBuilder() |
256 | 323 | .setMethodDescriptor(batchCreateEntitiesMethodDescriptor) |
| 324 | + .setParamsExtractor( |
| 325 | + new RequestParamsExtractor<BatchCreateEntitiesRequest>() { |
| 326 | + @Override |
| 327 | + public Map<String, String> extract(BatchCreateEntitiesRequest request) { |
| 328 | + ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); |
| 329 | + params.put("parent", String.valueOf(request.getParent())); |
| 330 | + return params.build(); |
| 331 | + } |
| 332 | + }) |
257 | 333 | .build(); |
258 | 334 | GrpcCallSettings<BatchUpdateEntitiesRequest, Operation> batchUpdateEntitiesTransportSettings = |
259 | 335 | GrpcCallSettings.<BatchUpdateEntitiesRequest, Operation>newBuilder() |
260 | 336 | .setMethodDescriptor(batchUpdateEntitiesMethodDescriptor) |
| 337 | + .setParamsExtractor( |
| 338 | + new RequestParamsExtractor<BatchUpdateEntitiesRequest>() { |
| 339 | + @Override |
| 340 | + public Map<String, String> extract(BatchUpdateEntitiesRequest request) { |
| 341 | + ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); |
| 342 | + params.put("parent", String.valueOf(request.getParent())); |
| 343 | + return params.build(); |
| 344 | + } |
| 345 | + }) |
261 | 346 | .build(); |
262 | 347 | GrpcCallSettings<BatchDeleteEntitiesRequest, Operation> batchDeleteEntitiesTransportSettings = |
263 | 348 | GrpcCallSettings.<BatchDeleteEntitiesRequest, Operation>newBuilder() |
264 | 349 | .setMethodDescriptor(batchDeleteEntitiesMethodDescriptor) |
| 350 | + .setParamsExtractor( |
| 351 | + new RequestParamsExtractor<BatchDeleteEntitiesRequest>() { |
| 352 | + @Override |
| 353 | + public Map<String, String> extract(BatchDeleteEntitiesRequest request) { |
| 354 | + ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); |
| 355 | + params.put("parent", String.valueOf(request.getParent())); |
| 356 | + return params.build(); |
| 357 | + } |
| 358 | + }) |
265 | 359 | .build(); |
266 | 360 |
|
267 | 361 | this.listEntityTypesCallable = |
|
0 commit comments