Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 16, 2023. It is now read-only.

Commit 596cd84

Browse files
feat: include original user query in WebhookRequest; add GetTextCaseresult API. doc: clarify resource format for session response.
PiperOrigin-RevId: 364838477 Source-Author: Google APIs <[email protected]> Source-Date: Wed Mar 24 10:43:06 2021 -0700 Source-Repo: googleapis/googleapis Source-Sha: 35593f2d62a2e6a11ad74ea64a664159939f52dd Source-Link: googleapis/googleapis@35593f2
1 parent 2091b1c commit 596cd84

File tree

27 files changed

+2883
-368
lines changed

27 files changed

+2883
-368
lines changed

google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/SessionEntityTypesClient.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,6 @@ public final SessionEntityType getSessionEntityType(GetSessionEntityTypeRequest
439439
/**
440440
* Creates a session entity type.
441441
*
442-
* <p>If the specified session entity type already exists, overrides the session entity type.
443-
*
444442
* <p>Sample code:
445443
*
446444
* <pre>{@code
@@ -476,8 +474,6 @@ public final SessionEntityType createSessionEntityType(
476474
/**
477475
* Creates a session entity type.
478476
*
479-
* <p>If the specified session entity type already exists, overrides the session entity type.
480-
*
481477
* <p>Sample code:
482478
*
483479
* <pre>{@code
@@ -514,8 +510,6 @@ public final SessionEntityType createSessionEntityType(
514510
/**
515511
* Creates a session entity type.
516512
*
517-
* <p>If the specified session entity type already exists, overrides the session entity type.
518-
*
519513
* <p>Sample code:
520514
*
521515
* <pre>{@code
@@ -543,8 +537,6 @@ public final SessionEntityType createSessionEntityType(CreateSessionEntityTypeRe
543537
/**
544538
* Creates a session entity type.
545539
*
546-
* <p>If the specified session entity type already exists, overrides the session entity type.
547-
*
548540
* <p>Sample code:
549541
*
550542
* <pre>{@code

google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/TestCasesClient.java

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,6 +1210,110 @@ public final ListTestCaseResultsPagedResponse listTestCaseResults(
12101210
return stub.listTestCaseResultsCallable();
12111211
}
12121212

1213+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1214+
/**
1215+
* Gets a test case result.
1216+
*
1217+
* <p>Sample code:
1218+
*
1219+
* <pre>{@code
1220+
* try (TestCasesClient testCasesClient = TestCasesClient.create()) {
1221+
* TestCaseResultName name =
1222+
* TestCaseResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]", "[RESULT]");
1223+
* TestCaseResult response = testCasesClient.getTestCaseResult(name);
1224+
* }
1225+
* }</pre>
1226+
*
1227+
* @param name Required. The name of the testcase. Format: `projects/&lt;Project
1228+
* ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/testCases/&lt;TestCase
1229+
* ID&gt;/results/&lt;TestCaseResult ID&gt;`.
1230+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1231+
*/
1232+
public final TestCaseResult getTestCaseResult(TestCaseResultName name) {
1233+
GetTestCaseResultRequest request =
1234+
GetTestCaseResultRequest.newBuilder()
1235+
.setName(name == null ? null : name.toString())
1236+
.build();
1237+
return getTestCaseResult(request);
1238+
}
1239+
1240+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1241+
/**
1242+
* Gets a test case result.
1243+
*
1244+
* <p>Sample code:
1245+
*
1246+
* <pre>{@code
1247+
* try (TestCasesClient testCasesClient = TestCasesClient.create()) {
1248+
* String name =
1249+
* TestCaseResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]", "[RESULT]")
1250+
* .toString();
1251+
* TestCaseResult response = testCasesClient.getTestCaseResult(name);
1252+
* }
1253+
* }</pre>
1254+
*
1255+
* @param name Required. The name of the testcase. Format: `projects/&lt;Project
1256+
* ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/testCases/&lt;TestCase
1257+
* ID&gt;/results/&lt;TestCaseResult ID&gt;`.
1258+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1259+
*/
1260+
public final TestCaseResult getTestCaseResult(String name) {
1261+
GetTestCaseResultRequest request = GetTestCaseResultRequest.newBuilder().setName(name).build();
1262+
return getTestCaseResult(request);
1263+
}
1264+
1265+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1266+
/**
1267+
* Gets a test case result.
1268+
*
1269+
* <p>Sample code:
1270+
*
1271+
* <pre>{@code
1272+
* try (TestCasesClient testCasesClient = TestCasesClient.create()) {
1273+
* GetTestCaseResultRequest request =
1274+
* GetTestCaseResultRequest.newBuilder()
1275+
* .setName(
1276+
* TestCaseResultName.of(
1277+
* "[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]", "[RESULT]")
1278+
* .toString())
1279+
* .build();
1280+
* TestCaseResult response = testCasesClient.getTestCaseResult(request);
1281+
* }
1282+
* }</pre>
1283+
*
1284+
* @param request The request object containing all of the parameters for the API call.
1285+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1286+
*/
1287+
public final TestCaseResult getTestCaseResult(GetTestCaseResultRequest request) {
1288+
return getTestCaseResultCallable().call(request);
1289+
}
1290+
1291+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1292+
/**
1293+
* Gets a test case result.
1294+
*
1295+
* <p>Sample code:
1296+
*
1297+
* <pre>{@code
1298+
* try (TestCasesClient testCasesClient = TestCasesClient.create()) {
1299+
* GetTestCaseResultRequest request =
1300+
* GetTestCaseResultRequest.newBuilder()
1301+
* .setName(
1302+
* TestCaseResultName.of(
1303+
* "[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]", "[RESULT]")
1304+
* .toString())
1305+
* .build();
1306+
* ApiFuture<TestCaseResult> future =
1307+
* testCasesClient.getTestCaseResultCallable().futureCall(request);
1308+
* // Do something.
1309+
* TestCaseResult response = future.get();
1310+
* }
1311+
* }</pre>
1312+
*/
1313+
public final UnaryCallable<GetTestCaseResultRequest, TestCaseResult> getTestCaseResultCallable() {
1314+
return stub.getTestCaseResultCallable();
1315+
}
1316+
12131317
@Override
12141318
public final void close() {
12151319
stub.close();

google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/TestCasesSettings.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ public UnaryCallSettings<ExportTestCasesRequest, Operation> exportTestCasesSetti
158158
return ((TestCasesStubSettings) getStubSettings()).listTestCaseResultsSettings();
159159
}
160160

161+
/** Returns the object with the settings used for calls to getTestCaseResult. */
162+
public UnaryCallSettings<GetTestCaseResultRequest, TestCaseResult> getTestCaseResultSettings() {
163+
return ((TestCasesStubSettings) getStubSettings()).getTestCaseResultSettings();
164+
}
165+
161166
public static final TestCasesSettings create(TestCasesStubSettings stub) throws IOException {
162167
return new TestCasesSettings.Builder(stub.toBuilder()).build();
163168
}
@@ -347,6 +352,12 @@ public UnaryCallSettings.Builder<ExportTestCasesRequest, Operation> exportTestCa
347352
return getStubSettingsBuilder().listTestCaseResultsSettings();
348353
}
349354

355+
/** Returns the builder for the settings used for calls to getTestCaseResult. */
356+
public UnaryCallSettings.Builder<GetTestCaseResultRequest, TestCaseResult>
357+
getTestCaseResultSettings() {
358+
return getStubSettingsBuilder().getTestCaseResultSettings();
359+
}
360+
350361
@Override
351362
public TestCasesSettings build() throws IOException {
352363
return new TestCasesSettings(this);

google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/gapic_metadata.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@
295295
"GetTestCase": {
296296
"methods": ["getTestCase", "getTestCase", "getTestCase", "getTestCaseCallable"]
297297
},
298+
"GetTestCaseResult": {
299+
"methods": ["getTestCaseResult", "getTestCaseResult", "getTestCaseResult", "getTestCaseResultCallable"]
300+
},
298301
"ImportTestCases": {
299302
"methods": ["importTestCasesAsync", "importTestCasesOperationCallable", "importTestCasesCallable"]
300303
},

google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GrpcTestCasesStub.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import com.google.cloud.dialogflow.cx.v3.ExportTestCasesRequest;
3939
import com.google.cloud.dialogflow.cx.v3.ExportTestCasesResponse;
4040
import com.google.cloud.dialogflow.cx.v3.GetTestCaseRequest;
41+
import com.google.cloud.dialogflow.cx.v3.GetTestCaseResultRequest;
4142
import com.google.cloud.dialogflow.cx.v3.ImportTestCasesMetadata;
4243
import com.google.cloud.dialogflow.cx.v3.ImportTestCasesRequest;
4344
import com.google.cloud.dialogflow.cx.v3.ImportTestCasesResponse;
@@ -49,6 +50,7 @@
4950
import com.google.cloud.dialogflow.cx.v3.RunTestCaseRequest;
5051
import com.google.cloud.dialogflow.cx.v3.RunTestCaseResponse;
5152
import com.google.cloud.dialogflow.cx.v3.TestCase;
53+
import com.google.cloud.dialogflow.cx.v3.TestCaseResult;
5254
import com.google.cloud.dialogflow.cx.v3.UpdateTestCaseRequest;
5355
import com.google.common.collect.ImmutableMap;
5456
import com.google.longrunning.Operation;
@@ -178,6 +180,16 @@ public class GrpcTestCasesStub extends TestCasesStub {
178180
ProtoUtils.marshaller(ListTestCaseResultsResponse.getDefaultInstance()))
179181
.build();
180182

183+
private static final MethodDescriptor<GetTestCaseResultRequest, TestCaseResult>
184+
getTestCaseResultMethodDescriptor =
185+
MethodDescriptor.<GetTestCaseResultRequest, TestCaseResult>newBuilder()
186+
.setType(MethodDescriptor.MethodType.UNARY)
187+
.setFullMethodName("google.cloud.dialogflow.cx.v3.TestCases/GetTestCaseResult")
188+
.setRequestMarshaller(
189+
ProtoUtils.marshaller(GetTestCaseResultRequest.getDefaultInstance()))
190+
.setResponseMarshaller(ProtoUtils.marshaller(TestCaseResult.getDefaultInstance()))
191+
.build();
192+
181193
private final UnaryCallable<ListTestCasesRequest, ListTestCasesResponse> listTestCasesCallable;
182194
private final UnaryCallable<ListTestCasesRequest, ListTestCasesPagedResponse>
183195
listTestCasesPagedCallable;
@@ -206,6 +218,7 @@ public class GrpcTestCasesStub extends TestCasesStub {
206218
listTestCaseResultsCallable;
207219
private final UnaryCallable<ListTestCaseResultsRequest, ListTestCaseResultsPagedResponse>
208220
listTestCaseResultsPagedCallable;
221+
private final UnaryCallable<GetTestCaseResultRequest, TestCaseResult> getTestCaseResultCallable;
209222

210223
private final BackgroundResource backgroundResources;
211224
private final GrpcOperationsStub operationsStub;
@@ -393,6 +406,19 @@ public Map<String, String> extract(ListTestCaseResultsRequest request) {
393406
}
394407
})
395408
.build();
409+
GrpcCallSettings<GetTestCaseResultRequest, TestCaseResult> getTestCaseResultTransportSettings =
410+
GrpcCallSettings.<GetTestCaseResultRequest, TestCaseResult>newBuilder()
411+
.setMethodDescriptor(getTestCaseResultMethodDescriptor)
412+
.setParamsExtractor(
413+
new RequestParamsExtractor<GetTestCaseResultRequest>() {
414+
@Override
415+
public Map<String, String> extract(GetTestCaseResultRequest request) {
416+
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
417+
params.put("name", String.valueOf(request.getName()));
418+
return params.build();
419+
}
420+
})
421+
.build();
396422

397423
this.listTestCasesCallable =
398424
callableFactory.createUnaryCallable(
@@ -467,6 +493,11 @@ public Map<String, String> extract(ListTestCaseResultsRequest request) {
467493
listTestCaseResultsTransportSettings,
468494
settings.listTestCaseResultsSettings(),
469495
clientContext);
496+
this.getTestCaseResultCallable =
497+
callableFactory.createUnaryCallable(
498+
getTestCaseResultTransportSettings,
499+
settings.getTestCaseResultSettings(),
500+
clientContext);
470501

471502
this.backgroundResources =
472503
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
@@ -570,6 +601,11 @@ public UnaryCallable<ExportTestCasesRequest, Operation> exportTestCasesCallable(
570601
return listTestCaseResultsPagedCallable;
571602
}
572603

604+
@Override
605+
public UnaryCallable<GetTestCaseResultRequest, TestCaseResult> getTestCaseResultCallable() {
606+
return getTestCaseResultCallable;
607+
}
608+
573609
@Override
574610
public final void close() {
575611
shutdown();

google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/TestCasesStub.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import com.google.cloud.dialogflow.cx.v3.ExportTestCasesRequest;
3434
import com.google.cloud.dialogflow.cx.v3.ExportTestCasesResponse;
3535
import com.google.cloud.dialogflow.cx.v3.GetTestCaseRequest;
36+
import com.google.cloud.dialogflow.cx.v3.GetTestCaseResultRequest;
3637
import com.google.cloud.dialogflow.cx.v3.ImportTestCasesMetadata;
3738
import com.google.cloud.dialogflow.cx.v3.ImportTestCasesRequest;
3839
import com.google.cloud.dialogflow.cx.v3.ImportTestCasesResponse;
@@ -44,6 +45,7 @@
4445
import com.google.cloud.dialogflow.cx.v3.RunTestCaseRequest;
4546
import com.google.cloud.dialogflow.cx.v3.RunTestCaseResponse;
4647
import com.google.cloud.dialogflow.cx.v3.TestCase;
48+
import com.google.cloud.dialogflow.cx.v3.TestCaseResult;
4749
import com.google.cloud.dialogflow.cx.v3.UpdateTestCaseRequest;
4850
import com.google.longrunning.Operation;
4951
import com.google.longrunning.stub.OperationsStub;
@@ -141,6 +143,10 @@ public UnaryCallable<ExportTestCasesRequest, Operation> exportTestCasesCallable(
141143
throw new UnsupportedOperationException("Not implemented: listTestCaseResultsCallable()");
142144
}
143145

146+
public UnaryCallable<GetTestCaseResultRequest, TestCaseResult> getTestCaseResultCallable() {
147+
throw new UnsupportedOperationException("Not implemented: getTestCaseResultCallable()");
148+
}
149+
144150
@Override
145151
public abstract void close();
146152
}

0 commit comments

Comments
 (0)