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

Commit

Permalink
feat: include original user query in WebhookRequest and add GetTextCa…
Browse files Browse the repository at this point in the history
…seresult API (#169)

This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/a5bf99b0-f2a5-4ac0-ae4c-9e4e0ef0adde/targets

- [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.)

PiperOrigin-RevId: 364838477
Source-Link: googleapis/googleapis@35593f2
PiperOrigin-RevId: 364734171
Source-Link: googleapis/googleapis@551ddbb
  • Loading branch information
yoshi-automation committed Mar 31, 2021
1 parent ca9417f commit 43cdc98
Show file tree
Hide file tree
Showing 53 changed files with 5,781 additions and 743 deletions.
Expand Up @@ -439,8 +439,6 @@ public final SessionEntityType getSessionEntityType(GetSessionEntityTypeRequest
/**
* Creates a session entity type.
*
* <p>If the specified session entity type already exists, overrides the session entity type.
*
* <p>Sample code:
*
* <pre>{@code
Expand Down Expand Up @@ -476,8 +474,6 @@ public final SessionEntityType createSessionEntityType(
/**
* Creates a session entity type.
*
* <p>If the specified session entity type already exists, overrides the session entity type.
*
* <p>Sample code:
*
* <pre>{@code
Expand Down Expand Up @@ -514,8 +510,6 @@ public final SessionEntityType createSessionEntityType(
/**
* Creates a session entity type.
*
* <p>If the specified session entity type already exists, overrides the session entity type.
*
* <p>Sample code:
*
* <pre>{@code
Expand Down Expand Up @@ -543,8 +537,6 @@ public final SessionEntityType createSessionEntityType(CreateSessionEntityTypeRe
/**
* Creates a session entity type.
*
* <p>If the specified session entity type already exists, overrides the session entity type.
*
* <p>Sample code:
*
* <pre>{@code
Expand Down
Expand Up @@ -1210,6 +1210,110 @@ public final ListTestCaseResultsPagedResponse listTestCaseResults(
return stub.listTestCaseResultsCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a test case result.
*
* <p>Sample code:
*
* <pre>{@code
* try (TestCasesClient testCasesClient = TestCasesClient.create()) {
* TestCaseResultName name =
* TestCaseResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]", "[RESULT]");
* TestCaseResult response = testCasesClient.getTestCaseResult(name);
* }
* }</pre>
*
* @param name Required. The name of the testcase. Format: `projects/&lt;Project
* ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/testCases/&lt;TestCase
* ID&gt;/results/&lt;TestCaseResult ID&gt;`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final TestCaseResult getTestCaseResult(TestCaseResultName name) {
GetTestCaseResultRequest request =
GetTestCaseResultRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return getTestCaseResult(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a test case result.
*
* <p>Sample code:
*
* <pre>{@code
* try (TestCasesClient testCasesClient = TestCasesClient.create()) {
* String name =
* TestCaseResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]", "[RESULT]")
* .toString();
* TestCaseResult response = testCasesClient.getTestCaseResult(name);
* }
* }</pre>
*
* @param name Required. The name of the testcase. Format: `projects/&lt;Project
* ID&gt;/locations/&lt;Location ID&gt;/agents/&lt;Agent ID&gt;/testCases/&lt;TestCase
* ID&gt;/results/&lt;TestCaseResult ID&gt;`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final TestCaseResult getTestCaseResult(String name) {
GetTestCaseResultRequest request = GetTestCaseResultRequest.newBuilder().setName(name).build();
return getTestCaseResult(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a test case result.
*
* <p>Sample code:
*
* <pre>{@code
* try (TestCasesClient testCasesClient = TestCasesClient.create()) {
* GetTestCaseResultRequest request =
* GetTestCaseResultRequest.newBuilder()
* .setName(
* TestCaseResultName.of(
* "[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]", "[RESULT]")
* .toString())
* .build();
* TestCaseResult response = testCasesClient.getTestCaseResult(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final TestCaseResult getTestCaseResult(GetTestCaseResultRequest request) {
return getTestCaseResultCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a test case result.
*
* <p>Sample code:
*
* <pre>{@code
* try (TestCasesClient testCasesClient = TestCasesClient.create()) {
* GetTestCaseResultRequest request =
* GetTestCaseResultRequest.newBuilder()
* .setName(
* TestCaseResultName.of(
* "[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]", "[RESULT]")
* .toString())
* .build();
* ApiFuture<TestCaseResult> future =
* testCasesClient.getTestCaseResultCallable().futureCall(request);
* // Do something.
* TestCaseResult response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<GetTestCaseResultRequest, TestCaseResult> getTestCaseResultCallable() {
return stub.getTestCaseResultCallable();
}

@Override
public final void close() {
stub.close();
Expand Down
Expand Up @@ -158,6 +158,11 @@ public UnaryCallSettings<ExportTestCasesRequest, Operation> exportTestCasesSetti
return ((TestCasesStubSettings) getStubSettings()).listTestCaseResultsSettings();
}

/** Returns the object with the settings used for calls to getTestCaseResult. */
public UnaryCallSettings<GetTestCaseResultRequest, TestCaseResult> getTestCaseResultSettings() {
return ((TestCasesStubSettings) getStubSettings()).getTestCaseResultSettings();
}

public static final TestCasesSettings create(TestCasesStubSettings stub) throws IOException {
return new TestCasesSettings.Builder(stub.toBuilder()).build();
}
Expand Down Expand Up @@ -347,6 +352,12 @@ public UnaryCallSettings.Builder<ExportTestCasesRequest, Operation> exportTestCa
return getStubSettingsBuilder().listTestCaseResultsSettings();
}

/** Returns the builder for the settings used for calls to getTestCaseResult. */
public UnaryCallSettings.Builder<GetTestCaseResultRequest, TestCaseResult>
getTestCaseResultSettings() {
return getStubSettingsBuilder().getTestCaseResultSettings();
}

@Override
public TestCasesSettings build() throws IOException {
return new TestCasesSettings(this);
Expand Down
Expand Up @@ -295,6 +295,9 @@
"GetTestCase": {
"methods": ["getTestCase", "getTestCase", "getTestCase", "getTestCaseCallable"]
},
"GetTestCaseResult": {
"methods": ["getTestCaseResult", "getTestCaseResult", "getTestCaseResult", "getTestCaseResultCallable"]
},
"ImportTestCases": {
"methods": ["importTestCasesAsync", "importTestCasesOperationCallable", "importTestCasesCallable"]
},
Expand Down
Expand Up @@ -38,6 +38,7 @@
import com.google.cloud.dialogflow.cx.v3.ExportTestCasesRequest;
import com.google.cloud.dialogflow.cx.v3.ExportTestCasesResponse;
import com.google.cloud.dialogflow.cx.v3.GetTestCaseRequest;
import com.google.cloud.dialogflow.cx.v3.GetTestCaseResultRequest;
import com.google.cloud.dialogflow.cx.v3.ImportTestCasesMetadata;
import com.google.cloud.dialogflow.cx.v3.ImportTestCasesRequest;
import com.google.cloud.dialogflow.cx.v3.ImportTestCasesResponse;
Expand All @@ -49,6 +50,7 @@
import com.google.cloud.dialogflow.cx.v3.RunTestCaseRequest;
import com.google.cloud.dialogflow.cx.v3.RunTestCaseResponse;
import com.google.cloud.dialogflow.cx.v3.TestCase;
import com.google.cloud.dialogflow.cx.v3.TestCaseResult;
import com.google.cloud.dialogflow.cx.v3.UpdateTestCaseRequest;
import com.google.common.collect.ImmutableMap;
import com.google.longrunning.Operation;
Expand Down Expand Up @@ -178,6 +180,16 @@ public class GrpcTestCasesStub extends TestCasesStub {
ProtoUtils.marshaller(ListTestCaseResultsResponse.getDefaultInstance()))
.build();

private static final MethodDescriptor<GetTestCaseResultRequest, TestCaseResult>
getTestCaseResultMethodDescriptor =
MethodDescriptor.<GetTestCaseResultRequest, TestCaseResult>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.dialogflow.cx.v3.TestCases/GetTestCaseResult")
.setRequestMarshaller(
ProtoUtils.marshaller(GetTestCaseResultRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(TestCaseResult.getDefaultInstance()))
.build();

private final UnaryCallable<ListTestCasesRequest, ListTestCasesResponse> listTestCasesCallable;
private final UnaryCallable<ListTestCasesRequest, ListTestCasesPagedResponse>
listTestCasesPagedCallable;
Expand Down Expand Up @@ -206,6 +218,7 @@ public class GrpcTestCasesStub extends TestCasesStub {
listTestCaseResultsCallable;
private final UnaryCallable<ListTestCaseResultsRequest, ListTestCaseResultsPagedResponse>
listTestCaseResultsPagedCallable;
private final UnaryCallable<GetTestCaseResultRequest, TestCaseResult> getTestCaseResultCallable;

private final BackgroundResource backgroundResources;
private final GrpcOperationsStub operationsStub;
Expand Down Expand Up @@ -393,6 +406,19 @@ public Map<String, String> extract(ListTestCaseResultsRequest request) {
}
})
.build();
GrpcCallSettings<GetTestCaseResultRequest, TestCaseResult> getTestCaseResultTransportSettings =
GrpcCallSettings.<GetTestCaseResultRequest, TestCaseResult>newBuilder()
.setMethodDescriptor(getTestCaseResultMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<GetTestCaseResultRequest>() {
@Override
public Map<String, String> extract(GetTestCaseResultRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("name", String.valueOf(request.getName()));
return params.build();
}
})
.build();

this.listTestCasesCallable =
callableFactory.createUnaryCallable(
Expand Down Expand Up @@ -467,6 +493,11 @@ public Map<String, String> extract(ListTestCaseResultsRequest request) {
listTestCaseResultsTransportSettings,
settings.listTestCaseResultsSettings(),
clientContext);
this.getTestCaseResultCallable =
callableFactory.createUnaryCallable(
getTestCaseResultTransportSettings,
settings.getTestCaseResultSettings(),
clientContext);

this.backgroundResources =
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
Expand Down Expand Up @@ -570,6 +601,11 @@ public UnaryCallable<ExportTestCasesRequest, Operation> exportTestCasesCallable(
return listTestCaseResultsPagedCallable;
}

@Override
public UnaryCallable<GetTestCaseResultRequest, TestCaseResult> getTestCaseResultCallable() {
return getTestCaseResultCallable;
}

@Override
public final void close() {
shutdown();
Expand Down
Expand Up @@ -33,6 +33,7 @@
import com.google.cloud.dialogflow.cx.v3.ExportTestCasesRequest;
import com.google.cloud.dialogflow.cx.v3.ExportTestCasesResponse;
import com.google.cloud.dialogflow.cx.v3.GetTestCaseRequest;
import com.google.cloud.dialogflow.cx.v3.GetTestCaseResultRequest;
import com.google.cloud.dialogflow.cx.v3.ImportTestCasesMetadata;
import com.google.cloud.dialogflow.cx.v3.ImportTestCasesRequest;
import com.google.cloud.dialogflow.cx.v3.ImportTestCasesResponse;
Expand All @@ -44,6 +45,7 @@
import com.google.cloud.dialogflow.cx.v3.RunTestCaseRequest;
import com.google.cloud.dialogflow.cx.v3.RunTestCaseResponse;
import com.google.cloud.dialogflow.cx.v3.TestCase;
import com.google.cloud.dialogflow.cx.v3.TestCaseResult;
import com.google.cloud.dialogflow.cx.v3.UpdateTestCaseRequest;
import com.google.longrunning.Operation;
import com.google.longrunning.stub.OperationsStub;
Expand Down Expand Up @@ -141,6 +143,10 @@ public UnaryCallable<ExportTestCasesRequest, Operation> exportTestCasesCallable(
throw new UnsupportedOperationException("Not implemented: listTestCaseResultsCallable()");
}

public UnaryCallable<GetTestCaseResultRequest, TestCaseResult> getTestCaseResultCallable() {
throw new UnsupportedOperationException("Not implemented: getTestCaseResultCallable()");
}

@Override
public abstract void close();
}

0 comments on commit 43cdc98

Please sign in to comment.