Reference documentation and code samples for the Google Cloud Dialogflow Cx V3 Client class PlaybooksClient.
Service Description: Service for managing Playbooks .
This class provides the ability to make remote calls to the backing service through method calls that map to API methods.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.
Namespace
Google \ Cloud \ Dialogflow \ Cx \ V3 \ ClientMethods
__construct
Constructor.
options
array| Google\ApiCore\Options\ClientOptions
Optional. Options for configuring the service API wrapper.
↳ apiEndpoint
string
The address of the API remote host. May optionally include the port, formatted as "
↳ credentials
Google\Auth\FetchAuthTokenInterface
| Google\ApiCore\CredentialsWrapper
This option should only be used with a pre-constructed Google\Auth\FetchAuthTokenInterface
or Google\ApiCore\CredentialsWrapper
object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. Important: If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly use Google\Auth\Credentials\ServiceAccountCredentials; use Google\Cloud\Dialogflow\Cx\V3\PlaybooksClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new PlaybooksClient(['credentials' => $creds]);
https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
↳ credentialsConfig
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .
↳ disableRetries
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to false
.
↳ clientConfig
string|array
Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder.
↳ transport
string| Google\ApiCore\Transport\TransportInterface
The transport used for executing network requests. May be either the string rest
or grpc
. Defaults to grpc
if gRPC support is detected on the system. Advanced usage
: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface
object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.
↳ transportConfig
array
Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options.
↳ clientCertSource
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS.
↳ logger
false| Psr\Log\LoggerInterface
A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag
↳ universeDomain
string
The service domain for the client. Defaults to 'googleapis.com'.
createPlaybook
Creates a playbook in a specified agent.
The async variant is PlaybooksClient::createPlaybookAsync() .
request
Google\Cloud\Dialogflow\Cx\V3\CreatePlaybookRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
Google\ApiCore\RetrySettings
|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\Dialogflow\Cx\V3\Client\PlaybooksClient;
use Google\Cloud\Dialogflow\Cx\V3\CreatePlaybookRequest;
use Google\Cloud\Dialogflow\Cx\V3\Playbook;
/**
* @param string $formattedParent The agent to create a playbook for.
* Format: `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`. Please see
* {@see PlaybooksClient::agentName()} for help formatting this field.
* @param string $playbookDisplayName The human-readable name of the playbook, unique within an agent.
* @param string $playbookGoal High level description of the goal the playbook intend to
* accomplish. A goal should be concise since it's visible to other playbooks
* that may reference this playbook.
*/
function create_playbook_sample(
string $formattedParent,
string $playbookDisplayName,
string $playbookGoal
): void {
// Create a client.
$playbooksClient = new PlaybooksClient();
// Prepare the request message.
$playbook = (new Playbook())
->setDisplayName($playbookDisplayName)
->setGoal($playbookGoal);
$request = (new CreatePlaybookRequest())
->setParent($formattedParent)
->setPlaybook($playbook);
// Call the API and handle any network failures.
try {
/** @var Playbook $response */
$response = $playbooksClient->createPlaybook($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
{
$formattedParent = PlaybooksClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]');
$playbookDisplayName = '[DISPLAY_NAME]';
$playbookGoal = '[GOAL]';
create_playbook_sample($formattedParent, $playbookDisplayName, $playbookGoal);
}
createPlaybookVersion
Creates a version for the specified Playbook.
The async variant is PlaybooksClient::createPlaybookVersionAsync() .
request
Google\Cloud\Dialogflow\Cx\V3\CreatePlaybookVersionRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
Google\ApiCore\RetrySettings
|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\Dialogflow\Cx\V3\Client\PlaybooksClient;
use Google\Cloud\Dialogflow\Cx\V3\CreatePlaybookVersionRequest;
use Google\Cloud\Dialogflow\Cx\V3\PlaybookVersion;
/**
* @param string $formattedParent The playbook to create a version for.
* Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>`. Please see
* {@see PlaybooksClient::playbookName()} for help formatting this field.
*/
function create_playbook_version_sample(string $formattedParent): void
{
// Create a client.
$playbooksClient = new PlaybooksClient();
// Prepare the request message.
$playbookVersion = new PlaybookVersion();
$request = (new CreatePlaybookVersionRequest())
->setParent($formattedParent)
->setPlaybookVersion($playbookVersion);
// Call the API and handle any network failures.
try {
/** @var PlaybookVersion $response */
$response = $playbooksClient->createPlaybookVersion($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
{
$formattedParent = PlaybooksClient::playbookName(
'[PROJECT]',
'[LOCATION]',
'[AGENT]',
'[PLAYBOOK]'
);
create_playbook_version_sample($formattedParent);
}
deletePlaybook
Deletes a specified playbook.
The async variant is PlaybooksClient::deletePlaybookAsync() .
request
Google\Cloud\Dialogflow\Cx\V3\DeletePlaybookRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
Google\ApiCore\RetrySettings
|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\Dialogflow\Cx\V3\Client\PlaybooksClient;
use Google\Cloud\Dialogflow\Cx\V3\DeletePlaybookRequest;
/**
* @param string $formattedName The name of the playbook to delete.
* Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>`. Please see
* {@see PlaybooksClient::playbookName()} for help formatting this field.
*/
function delete_playbook_sample(string $formattedName): void
{
// Create a client.
$playbooksClient = new PlaybooksClient();
// Prepare the request message.
$request = (new DeletePlaybookRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$playbooksClient->deletePlaybook($request);
printf('Call completed successfully.' . PHP_EOL);
} 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 = PlaybooksClient::playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]');
delete_playbook_sample($formattedName);
}
deletePlaybookVersion
Deletes the specified version of the Playbook.
The async variant is PlaybooksClient::deletePlaybookVersionAsync() .
request
Google\Cloud\Dialogflow\Cx\V3\DeletePlaybookVersionRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
Google\ApiCore\RetrySettings
|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\Dialogflow\Cx\V3\Client\PlaybooksClient;
use Google\Cloud\Dialogflow\Cx\V3\DeletePlaybookVersionRequest;
/**
* @param string $formattedName The name of the playbook version to delete.
* Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>/versions/<VersionID>`. Please see
* {@see PlaybooksClient::playbookVersionName()} for help formatting this field.
*/
function delete_playbook_version_sample(string $formattedName): void
{
// Create a client.
$playbooksClient = new PlaybooksClient();
// Prepare the request message.
$request = (new DeletePlaybookVersionRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$playbooksClient->deletePlaybookVersion($request);
printf('Call completed successfully.' . PHP_EOL);
} 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 = PlaybooksClient::playbookVersionName(
'[PROJECT]',
'[LOCATION]',
'[AGENT]',
'[PLAYBOOK]',
'[VERSION]'
);
delete_playbook_version_sample($formattedName);
}
exportPlaybook
Exports the specified playbook to a binary file.
Note that resources (e.g. examples, tools) that the playbook references will also be exported.
The async variant is PlaybooksClient::exportPlaybookAsync() .
request
Google\Cloud\Dialogflow\Cx\V3\ExportPlaybookRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
Google\ApiCore\RetrySettings
|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Dialogflow\Cx\V3\Client\PlaybooksClient;
use Google\Cloud\Dialogflow\Cx\V3\ExportPlaybookRequest;
use Google\Cloud\Dialogflow\Cx\V3\ExportPlaybookResponse;
use Google\Rpc\Status;
/**
* @param string $formattedName The name of the playbook to export.
* Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>`. Please see
* {@see PlaybooksClient::playbookName()} for help formatting this field.
*/
function export_playbook_sample(string $formattedName): void
{
// Create a client.
$playbooksClient = new PlaybooksClient();
// Prepare the request message.
$request = (new ExportPlaybookRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $playbooksClient->exportPlaybook($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var ExportPlaybookResponse $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 = PlaybooksClient::playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]');
export_playbook_sample($formattedName);
}
getPlaybook
Retrieves the specified Playbook.
The async variant is PlaybooksClient::getPlaybookAsync() .
request
Google\Cloud\Dialogflow\Cx\V3\GetPlaybookRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
Google\ApiCore\RetrySettings
|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\Dialogflow\Cx\V3\Client\PlaybooksClient;
use Google\Cloud\Dialogflow\Cx\V3\GetPlaybookRequest;
use Google\Cloud\Dialogflow\Cx\V3\Playbook;
/**
* @param string $formattedName The name of the playbook.
* Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>`. Please see
* {@see PlaybooksClient::playbookName()} for help formatting this field.
*/
function get_playbook_sample(string $formattedName): void
{
// Create a client.
$playbooksClient = new PlaybooksClient();
// Prepare the request message.
$request = (new GetPlaybookRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Playbook $response */
$response = $playbooksClient->getPlaybook($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 = PlaybooksClient::playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]');
get_playbook_sample($formattedName);
}
getPlaybookVersion
Retrieves the specified version of the Playbook.
The async variant is PlaybooksClient::getPlaybookVersionAsync() .
request
Google\Cloud\Dialogflow\Cx\V3\GetPlaybookVersionRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
Google\ApiCore\RetrySettings
|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\Dialogflow\Cx\V3\Client\PlaybooksClient;
use Google\Cloud\Dialogflow\Cx\V3\GetPlaybookVersionRequest;
use Google\Cloud\Dialogflow\Cx\V3\PlaybookVersion;
/**
* @param string $formattedName The name of the playbook version.
* Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>/versions/<VersionID>`. Please see
* {@see PlaybooksClient::playbookVersionName()} for help formatting this field.
*/
function get_playbook_version_sample(string $formattedName): void
{
// Create a client.
$playbooksClient = new PlaybooksClient();
// Prepare the request message.
$request = (new GetPlaybookVersionRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var PlaybookVersion $response */
$response = $playbooksClient->getPlaybookVersion($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 = PlaybooksClient::playbookVersionName(
'[PROJECT]',
'[LOCATION]',
'[AGENT]',
'[PLAYBOOK]',
'[VERSION]'
);
get_playbook_version_sample($formattedName);
}
importPlaybook
Imports the specified playbook to the specified agent from a binary file.
The async variant is PlaybooksClient::importPlaybookAsync() .
request
Google\Cloud\Dialogflow\Cx\V3\ImportPlaybookRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
Google\ApiCore\RetrySettings
|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Dialogflow\Cx\V3\Client\PlaybooksClient;
use Google\Cloud\Dialogflow\Cx\V3\ImportPlaybookRequest;
use Google\Cloud\Dialogflow\Cx\V3\ImportPlaybookResponse;
use Google\Rpc\Status;
/**
* @param string $formattedParent The agent to import the playbook into.
* Format: `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`. Please see
* {@see PlaybooksClient::agentName()} for help formatting this field.
*/
function import_playbook_sample(string $formattedParent): void
{
// Create a client.
$playbooksClient = new PlaybooksClient();
// Prepare the request message.
$request = (new ImportPlaybookRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $playbooksClient->importPlaybook($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var ImportPlaybookResponse $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 = PlaybooksClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]');
import_playbook_sample($formattedParent);
}
listPlaybookVersions
Lists versions for the specified Playbook.
The async variant is PlaybooksClient::listPlaybookVersionsAsync() .
request
Google\Cloud\Dialogflow\Cx\V3\ListPlaybookVersionsRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
Google\ApiCore\RetrySettings
|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Dialogflow\Cx\V3\Client\PlaybooksClient;
use Google\Cloud\Dialogflow\Cx\V3\ListPlaybookVersionsRequest;
use Google\Cloud\Dialogflow\Cx\V3\PlaybookVersion;
/**
* @param string $formattedParent The playbook to list versions for.
* Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>`. Please see
* {@see PlaybooksClient::playbookName()} for help formatting this field.
*/
function list_playbook_versions_sample(string $formattedParent): void
{
// Create a client.
$playbooksClient = new PlaybooksClient();
// Prepare the request message.
$request = (new ListPlaybookVersionsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $playbooksClient->listPlaybookVersions($request);
/** @var PlaybookVersion $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->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 = PlaybooksClient::playbookName(
'[PROJECT]',
'[LOCATION]',
'[AGENT]',
'[PLAYBOOK]'
);
list_playbook_versions_sample($formattedParent);
}
listPlaybooks
Returns a list of playbooks in the specified agent.
The async variant is PlaybooksClient::listPlaybooksAsync() .
request
Google\Cloud\Dialogflow\Cx\V3\ListPlaybooksRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
Google\ApiCore\RetrySettings
|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Dialogflow\Cx\V3\Client\PlaybooksClient;
use Google\Cloud\Dialogflow\Cx\V3\ListPlaybooksRequest;
use Google\Cloud\Dialogflow\Cx\V3\Playbook;
/**
* @param string $formattedParent The agent to list playbooks from.
* Format: `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`. Please see
* {@see PlaybooksClient::agentName()} for help formatting this field.
*/
function list_playbooks_sample(string $formattedParent): void
{
// Create a client.
$playbooksClient = new PlaybooksClient();
// Prepare the request message.
$request = (new ListPlaybooksRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $playbooksClient->listPlaybooks($request);
/** @var Playbook $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->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 = PlaybooksClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]');
list_playbooks_sample($formattedParent);
}
restorePlaybookVersion
Retrieves the specified version of the Playbook and stores it as the current playbook draft, returning the playbook with resources updated.
The async variant is PlaybooksClient::restorePlaybookVersionAsync() .
request
Google\Cloud\Dialogflow\Cx\V3\RestorePlaybookVersionRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
Google\ApiCore\RetrySettings
|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\Dialogflow\Cx\V3\Client\PlaybooksClient;
use Google\Cloud\Dialogflow\Cx\V3\RestorePlaybookVersionRequest;
use Google\Cloud\Dialogflow\Cx\V3\RestorePlaybookVersionResponse;
/**
* @param string $formattedName The name of the playbook version.
* Format:
* `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>/versions/<VersionID>`. Please see
* {@see PlaybooksClient::playbookVersionName()} for help formatting this field.
*/
function restore_playbook_version_sample(string $formattedName): void
{
// Create a client.
$playbooksClient = new PlaybooksClient();
// Prepare the request message.
$request = (new RestorePlaybookVersionRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var RestorePlaybookVersionResponse $response */
$response = $playbooksClient->restorePlaybookVersion($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 = PlaybooksClient::playbookVersionName(
'[PROJECT]',
'[LOCATION]',
'[AGENT]',
'[PLAYBOOK]',
'[VERSION]'
);
restore_playbook_version_sample($formattedName);
}
updatePlaybook
Updates the specified Playbook.
The async variant is PlaybooksClient::updatePlaybookAsync() .
request
Google\Cloud\Dialogflow\Cx\V3\UpdatePlaybookRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
Google\ApiCore\RetrySettings
|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\Dialogflow\Cx\V3\Client\PlaybooksClient;
use Google\Cloud\Dialogflow\Cx\V3\Playbook;
use Google\Cloud\Dialogflow\Cx\V3\UpdatePlaybookRequest;
/**
* @param string $playbookDisplayName The human-readable name of the playbook, unique within an agent.
* @param string $playbookGoal High level description of the goal the playbook intend to
* accomplish. A goal should be concise since it's visible to other playbooks
* that may reference this playbook.
*/
function update_playbook_sample(string $playbookDisplayName, string $playbookGoal): void
{
// Create a client.
$playbooksClient = new PlaybooksClient();
// Prepare the request message.
$playbook = (new Playbook())
->setDisplayName($playbookDisplayName)
->setGoal($playbookGoal);
$request = (new UpdatePlaybookRequest())
->setPlaybook($playbook);
// Call the API and handle any network failures.
try {
/** @var Playbook $response */
$response = $playbooksClient->updatePlaybook($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
{
$playbookDisplayName = '[DISPLAY_NAME]';
$playbookGoal = '[GOAL]';
update_playbook_sample($playbookDisplayName, $playbookGoal);
}
getLocation
Gets information about a location.
The async variant is PlaybooksClient::getLocationAsync() .
request
callOptions
array
Optional.
↳ retrySettings
Google\ApiCore\RetrySettings
|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\Dialogflow\Cx\V3\Client\PlaybooksClient;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
/**
* 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 get_location_sample(): void
{
// Create a client.
$playbooksClient = new PlaybooksClient();
// Prepare the request message.
$request = new GetLocationRequest();
// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $playbooksClient->getLocation($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
listLocations
Lists information about the supported locations for this service.
This method lists locations based on the resource scope provided in the [ListLocationsRequest.name] field:
Global locations: If name
is empty, the method lists the
public locations available to all projects. * Project-specific
locations: If name
follows the format projects/{project}
, the method lists locations visible to that
specific project. This includes public, private, or other
project-specific locations enabled for the project.
For gRPC and client library implementations, the resource name is
passed as the name
field. For direct service calls, the resource
name is
incorporated into the request path based on the specific service
implementation and version.
The async variant is PlaybooksClient::listLocationsAsync() .
request
callOptions
array
Optional.
↳ retrySettings
Google\ApiCore\RetrySettings
|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Dialogflow\Cx\V3\Client\PlaybooksClient;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
/**
* 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 list_locations_sample(): void
{
// Create a client.
$playbooksClient = new PlaybooksClient();
// Prepare the request message.
$request = new ListLocationsRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $playbooksClient->listLocations($request);
/** @var Location $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
createPlaybookAsync
optionalArgs
array
createPlaybookVersionAsync
optionalArgs
array
deletePlaybookAsync
optionalArgs
array
deletePlaybookVersionAsync
optionalArgs
array
exportPlaybookAsync
optionalArgs
array
getPlaybookAsync
optionalArgs
array
getPlaybookVersionAsync
optionalArgs
array
importPlaybookAsync
optionalArgs
array
listPlaybookVersionsAsync
optionalArgs
array
listPlaybooksAsync
optionalArgs
array
restorePlaybookVersionAsync
optionalArgs
array
updatePlaybookAsync
optionalArgs
array
getLocationAsync
listLocationsAsync
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
Google\LongRunning\Client\OperationsClient
resumeOperation
Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.
operationName
string
The name of the long running operation
methodName
string
The name of the method used to start the operation
static::agentName
Formats a string containing the fully-qualified path to represent a agent resource.
project
string
location
string
agent
string
string
static::exampleName
Formats a string containing the fully-qualified path to represent a example resource.
project
string
location
string
agent
string
playbook
string
example
string
string
static::flowName
Formats a string containing the fully-qualified path to represent a flow resource.
project
string
location
string
agent
string
flow
string
string
static::generatorName
Formats a string containing the fully-qualified path to represent a generator resource.
project
string
location
string
agent
string
generator
string
string
static::playbookName
Formats a string containing the fully-qualified path to represent a playbook resource.
project
string
location
string
agent
string
playbook
string
string
static::playbookVersionName
Formats a string containing the fully-qualified path to represent a playbook_version resource.
project
string
location
string
agent
string
playbook
string
version
string
string
static::toolName
Formats a string containing the fully-qualified path to represent a tool resource.
project
string
location
string
agent
string
tool
string
string
static::webhookName
Formats a string containing the fully-qualified path to represent a webhook resource.
project
string
location
string
agent
string
webhook
string
string
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- agent: projects/{project}/locations/{location}/agents/{agent}
- example: projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}/examples/{example}
- flow: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}
- generator: projects/{project}/locations/{location}/agents/{agent}/generators/{generator}
- playbook: projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}
- playbookVersion: projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}/versions/{version}
- tool: projects/{project}/locations/{location}/agents/{agent}/tools/{tool}
- webhook: projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
formattedName
string
The formatted name string
template
?string
Optional name of template to match
array

