Skip to content

Commit

Permalink
feat: Add import / export IssueModel (#7731)
Browse files Browse the repository at this point in the history
feat: Add CMEK InitializeLroSpec
feat: Add metadata import to IngestConversations
feat: Add sampling to IngestConversations
docs: Add a comment for valid `order_by` values in ListConversations
docs: Add a comment for valid `update_mask` values in UpdateConversation
PiperOrigin-RevId: 683188578
Source-Link: googleapis/googleapis@d0eeab3
Source-Link: googleapis/googleapis-gen@4d5b300
Copy-Tag: eyJwIjoiQ29udGFjdENlbnRlckluc2lnaHRzLy5Pd2xCb3QueWFtbCIsImgiOiI0ZDViMzAwYTcyNDljZTI0Mjc4ZmJlNzdjMTY5ODNhMDZkNmU0YTVkIn0=
  • Loading branch information
gcf-owl-bot[bot] authored Oct 11, 2024
1 parent 4021aec commit 534f367
Show file tree
Hide file tree
Showing 44 changed files with 3,370 additions and 38 deletions.
Binary file modified ContactCenterInsights/metadata/V1/ContactCenterInsights.php
Binary file not shown.
Binary file modified ContactCenterInsights/metadata/V1/Resources.php
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

/**
* Creates a conversation.
* Note that this method does not support audio transcription or redaction.
* Use `conversations.upload` instead.
*
* @param string $formattedParent The parent resource of the conversation. Please see
* {@see ContactCenterInsightsClient::locationName()} for help formatting this field.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START contactcenterinsights_v1_generated_ContactCenterInsights_ExportIssueModel_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\ContactCenterInsights\V1\Client\ContactCenterInsightsClient;
use Google\Cloud\ContactCenterInsights\V1\ExportIssueModelRequest;
use Google\Cloud\ContactCenterInsights\V1\ExportIssueModelResponse;
use Google\Rpc\Status;

/**
* Exports an issue model to the provided destination.
*
* @param string $formattedName The issue model to export. Please see
* {@see ContactCenterInsightsClient::issueModelName()} for help formatting this field.
*/
function export_issue_model_sample(string $formattedName): void
{
// Create a client.
$contactCenterInsightsClient = new ContactCenterInsightsClient();

// Prepare the request message.
$request = (new ExportIssueModelRequest())
->setName($formattedName);

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $contactCenterInsightsClient->exportIssueModel($request);
$response->pollUntilComplete();

if ($response->operationSucceeded()) {
/** @var ExportIssueModelResponse $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = ContactCenterInsightsClient::issueModelName(
'[PROJECT]',
'[LOCATION]',
'[ISSUE_MODEL]'
);

export_issue_model_sample($formattedName);
}
// [END contactcenterinsights_v1_generated_ContactCenterInsights_ExportIssueModel_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START contactcenterinsights_v1_generated_ContactCenterInsights_GetEncryptionSpec_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\ContactCenterInsights\V1\Client\ContactCenterInsightsClient;
use Google\Cloud\ContactCenterInsights\V1\EncryptionSpec;
use Google\Cloud\ContactCenterInsights\V1\GetEncryptionSpecRequest;

/**
* Gets location-level encryption key specification.
*
* @param string $formattedName The name of the encryption spec resource to get. Please see
* {@see ContactCenterInsightsClient::encryptionSpecName()} for help formatting this field.
*/
function get_encryption_spec_sample(string $formattedName): void
{
// Create a client.
$contactCenterInsightsClient = new ContactCenterInsightsClient();

// Prepare the request message.
$request = (new GetEncryptionSpecRequest())
->setName($formattedName);

// Call the API and handle any network failures.
try {
/** @var EncryptionSpec $response */
$response = $contactCenterInsightsClient->getEncryptionSpec($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = ContactCenterInsightsClient::encryptionSpecName('[PROJECT]', '[LOCATION]');

get_encryption_spec_sample($formattedName);
}
// [END contactcenterinsights_v1_generated_ContactCenterInsights_GetEncryptionSpec_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START contactcenterinsights_v1_generated_ContactCenterInsights_ImportIssueModel_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\ContactCenterInsights\V1\Client\ContactCenterInsightsClient;
use Google\Cloud\ContactCenterInsights\V1\ImportIssueModelRequest;
use Google\Cloud\ContactCenterInsights\V1\ImportIssueModelResponse;
use Google\Rpc\Status;

/**
* Imports an issue model from a Cloud Storage bucket.
*
* @param string $formattedParent The parent resource of the issue model. Please see
* {@see ContactCenterInsightsClient::locationName()} for help formatting this field.
*/
function import_issue_model_sample(string $formattedParent): void
{
// Create a client.
$contactCenterInsightsClient = new ContactCenterInsightsClient();

// Prepare the request message.
$request = (new ImportIssueModelRequest())
->setParent($formattedParent);

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $contactCenterInsightsClient->importIssueModel($request);
$response->pollUntilComplete();

if ($response->operationSucceeded()) {
/** @var ImportIssueModelResponse $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = ContactCenterInsightsClient::locationName('[PROJECT]', '[LOCATION]');

import_issue_model_sample($formattedParent);
}
// [END contactcenterinsights_v1_generated_ContactCenterInsights_ImportIssueModel_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?php
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START contactcenterinsights_v1_generated_ContactCenterInsights_InitializeEncryptionSpec_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\ContactCenterInsights\V1\Client\ContactCenterInsightsClient;
use Google\Cloud\ContactCenterInsights\V1\EncryptionSpec;
use Google\Cloud\ContactCenterInsights\V1\InitializeEncryptionSpecRequest;
use Google\Cloud\ContactCenterInsights\V1\InitializeEncryptionSpecResponse;
use Google\Rpc\Status;

/**
* Initializes a location-level encryption key specification. An error will
* be thrown if the location has resources already created before the
* initialization. Once the encryption specification is initialized at a
* location, it is immutable and all newly created resources under the
* location will be encrypted with the existing specification.
*
* @param string $encryptionSpecKmsKey The name of customer-managed encryption key that is used to
* secure a resource and its sub-resources. If empty, the resource is secured
* by the default Google encryption key. Only the key in the same location as
* this resource is allowed to be used for encryption. Format:
* `projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{key}`
*/
function initialize_encryption_spec_sample(string $encryptionSpecKmsKey): void
{
// Create a client.
$contactCenterInsightsClient = new ContactCenterInsightsClient();

// Prepare the request message.
$encryptionSpec = (new EncryptionSpec())
->setKmsKey($encryptionSpecKmsKey);
$request = (new InitializeEncryptionSpecRequest())
->setEncryptionSpec($encryptionSpec);

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $contactCenterInsightsClient->initializeEncryptionSpec($request);
$response->pollUntilComplete();

if ($response->operationSucceeded()) {
/** @var InitializeEncryptionSpecResponse $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$encryptionSpecKmsKey = '[KMS_KEY]';

initialize_encryption_spec_sample($encryptionSpecKmsKey);
}
// [END contactcenterinsights_v1_generated_ContactCenterInsights_InitializeEncryptionSpec_sync]
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
use Google\Rpc\Status;

/**
* Create a longrunning conversation upload operation. This method differs
* from CreateConversation by allowing audio transcription and optional DLP
* Create a long-running conversation upload operation. This method differs
* from `CreateConversation` by allowing audio transcription and optional DLP
* redaction.
*
* @param string $formattedParent The parent resource of the conversation. Please see
Expand Down
Loading

0 comments on commit 534f367

Please sign in to comment.