Google Cloud Dialogflow Cx V3 Client - Class FlowsClient (0.1.1)

Reference documentation and code samples for the Google Cloud Dialogflow Cx V3 Client class FlowsClient.

Service Description: Service for managing Flows .

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:

 $flowsClient = new FlowsClient();
try {
    $formattedParent = $flowsClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]');
    $flow = new Flow();
    $response = $flowsClient->createFlow($formattedParent, $flow);
} finally {
    $flowsClient->close();
} 

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

Methods

__construct

Constructor.

Parameters
Name
Description
options
array

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
string|array|FetchAuthTokenInterface|CredentialsWrapper

The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage : In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored.

↳ 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|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.

createFlow

Creates a flow in the specified agent.

Note: You should always train a flow prior to sending it queries. See the training documentation .

Parameters
Name
Description
parent
string

Required. The agent to create a flow for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID> .

flow
Google\Cloud\Dialogflow\Cx\V3\Flow

Required. The flow to create.

optionalArgs
array

Optional.

↳ languageCode
string

The language of the following fields in flow : * Flow.event_handlers.trigger_fulfillment.messages * Flow.event_handlers.trigger_fulfillment.conditional_cases * Flow.transition_routes.trigger_fulfillment.messages * Flow.transition_routes.trigger_fulfillment.conditional_cases If not specified, the agent's default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.

↳ retrySettings
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.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Dialogflow\Cx\V3\Flow;
use Google\Cloud\Dialogflow\Cx\V3\FlowsClient;

/**
 * @param string $formattedParent The agent to create a flow for.
 *                                Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`. Please see
 *                                {@see FlowsClient::agentName()} for help formatting this field.
 * @param string $flowDisplayName The human-readable name of the flow.
 */
function create_flow_sample(string $formattedParent, string $flowDisplayName): void
{
    // Create a client.
    $flowsClient = new FlowsClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $flow = (new Flow())
        ->setDisplayName($flowDisplayName);

    // Call the API and handle any network failures.
    try {
        /** @var Flow $response */
        $response = $flowsClient->createFlow($formattedParent, $flow);
        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 = FlowsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]');
    $flowDisplayName = '[DISPLAY_NAME]';

    create_flow_sample($formattedParent, $flowDisplayName);
} 

deleteFlow

Deletes a specified flow.

Parameters
Name
Description
name
string

Required. The name of the flow to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID> .

optionalArgs
array

Optional.

↳ force
bool

This field has no effect for flows with no incoming transitions. For flows with incoming transitions: * If force is set to false, an error will be returned with message indicating the incoming transitions. * If force is set to true, Dialogflow will remove the flow, as well as any transitions to the flow (i.e. Target flow in event handlers or Target flow in transition routes that point to this flow will be cleared).

↳ retrySettings
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.

Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Dialogflow\Cx\V3\FlowsClient;

/**
 * @param string $formattedName The name of the flow to delete.
 *                              Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
 *                              ID>/flows/<Flow ID>`. Please see
 *                              {@see FlowsClient::flowName()} for help formatting this field.
 */
function delete_flow_sample(string $formattedName): void
{
    // Create a client.
    $flowsClient = new FlowsClient();

    // Call the API and handle any network failures.
    try {
        $flowsClient->deleteFlow($formattedName);
        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 = FlowsClient::flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]');

    delete_flow_sample($formattedName);
} 

exportFlow

Exports the specified flow to a binary file.

This method is a long-running operation . The returned Operation type has the following method-specific fields:

Note that resources (e.g. intents, entities, webhooks) that the flow references will also be exported.

Parameters
Name
Description
name
string

Required. The name of the flow to export. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID> .

optionalArgs
array

Optional.

↳ flowUri
string

Optional. The Google Cloud Storage URI to export the flow to. The format of this URI must be gs://<bucket-name>/<object-name> . If left unspecified, the serialized flow is returned inline. Dialogflow performs a write operation for the Cloud Storage object on the caller's behalf, so your request authentication must have write permissions for the object. For more information, see Dialogflow access control .

↳ includeReferencedFlows
bool

Optional. Whether to export flows referenced by the specified flow.

↳ retrySettings
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.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Dialogflow\Cx\V3\ExportFlowResponse;
use Google\Cloud\Dialogflow\Cx\V3\FlowsClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the flow to export.
 *                              Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
 *                              ID>/flows/<Flow ID>`. Please see
 *                              {@see FlowsClient::flowName()} for help formatting this field.
 */
function export_flow_sample(string $formattedName): void
{
    // Create a client.
    $flowsClient = new FlowsClient();

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

        if ($response->operationSucceeded()) {
            /** @var ExportFlowResponse $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 = FlowsClient::flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]');

    export_flow_sample($formattedName);
} 

getFlow

Retrieves the specified flow.

Parameters
Name
Description
name
string

Required. The name of the flow to get. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID> .

optionalArgs
array

Optional.

↳ languageCode
string

The language to retrieve the flow for. The following fields are language dependent: * Flow.event_handlers.trigger_fulfillment.messages * Flow.event_handlers.trigger_fulfillment.conditional_cases * Flow.transition_routes.trigger_fulfillment.messages * Flow.transition_routes.trigger_fulfillment.conditional_cases If not specified, the agent's default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.

↳ retrySettings
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.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Dialogflow\Cx\V3\Flow;
use Google\Cloud\Dialogflow\Cx\V3\FlowsClient;

/**
 * @param string $formattedName The name of the flow to get.
 *                              Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
 *                              ID>/flows/<Flow ID>`. Please see
 *                              {@see FlowsClient::flowName()} for help formatting this field.
 */
function get_flow_sample(string $formattedName): void
{
    // Create a client.
    $flowsClient = new FlowsClient();

    // Call the API and handle any network failures.
    try {
        /** @var Flow $response */
        $response = $flowsClient->getFlow($formattedName);
        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 = FlowsClient::flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]');

    get_flow_sample($formattedName);
} 

getFlowValidationResult

Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called.

Parameters
Name
Description
name
string

Required. The flow name. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/validationResult .

optionalArgs
array

Optional.

↳ languageCode
string

If not specified, the agent's default language is used.

↳ retrySettings
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.

Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Dialogflow\Cx\V3\FlowValidationResult;
use Google\Cloud\Dialogflow\Cx\V3\FlowsClient;

/**
 * @param string $formattedName The flow name.
 *                              Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
 *                              ID>/flows/<Flow ID>/validationResult`. Please see
 *                              {@see FlowsClient::flowValidationResultName()} for help formatting this field.
 */
function get_flow_validation_result_sample(string $formattedName): void
{
    // Create a client.
    $flowsClient = new FlowsClient();

    // Call the API and handle any network failures.
    try {
        /** @var FlowValidationResult $response */
        $response = $flowsClient->getFlowValidationResult($formattedName);
        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 = FlowsClient::flowValidationResultName(
        '[PROJECT]',
        '[LOCATION]',
        '[AGENT]',
        '[FLOW]'
    );

    get_flow_validation_result_sample($formattedName);
} 

importFlow

Imports the specified flow to the specified agent from a binary file.

This method is a long-running operation . The returned Operation type has the following method-specific fields:

Note: You should always train a flow prior to sending it queries. See the training documentation .

Parameters
Name
Description
parent
string

Required. The agent to import the flow into. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID> .

optionalArgs
array

Optional.

↳ flowUri
string

The Google Cloud Storage URI to import flow from. The format of this URI must be gs://<bucket-name>/<object-name> . Dialogflow performs a read operation for the Cloud Storage object on the caller's behalf, so your request authentication must have read permissions for the object. For more information, see Dialogflow access control .

↳ flowContent
string

Uncompressed raw byte content for flow.

↳ importOption
int

Flow import mode. If not specified, KEEP is assumed. For allowed values, use constants defined on Google\Cloud\Dialogflow\Cx\V3\ImportFlowRequest\ImportOption

↳ flowImportStrategy
FlowImportStrategy

Optional. Specifies the import strategy used when resolving resource conflicts.

↳ retrySettings
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.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Dialogflow\Cx\V3\FlowsClient;
use Google\Cloud\Dialogflow\Cx\V3\ImportFlowResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The agent to import the flow into.
 *                                Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`. Please see
 *                                {@see FlowsClient::agentName()} for help formatting this field.
 */
function import_flow_sample(string $formattedParent): void
{
    // Create a client.
    $flowsClient = new FlowsClient();

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

        if ($response->operationSucceeded()) {
            /** @var ImportFlowResponse $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 = FlowsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]');

    import_flow_sample($formattedParent);
} 

listFlows

Returns the list of all flows in the specified agent.

Parameters
Name
Description
parent
string

Required. The agent containing the flows. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID> .

optionalArgs
array

Optional.

↳ pageSize
int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken
string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ languageCode
string

The language to list flows for. The following fields are language dependent: * Flow.event_handlers.trigger_fulfillment.messages * Flow.event_handlers.trigger_fulfillment.conditional_cases * Flow.transition_routes.trigger_fulfillment.messages * Flow.transition_routes.trigger_fulfillment.conditional_cases If not specified, the agent's default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.

↳ retrySettings
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.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Dialogflow\Cx\V3\Flow;
use Google\Cloud\Dialogflow\Cx\V3\FlowsClient;

/**
 * @param string $formattedParent The agent containing the flows.
 *                                Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`. Please see
 *                                {@see FlowsClient::agentName()} for help formatting this field.
 */
function list_flows_sample(string $formattedParent): void
{
    // Create a client.
    $flowsClient = new FlowsClient();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $flowsClient->listFlows($formattedParent);

        /** @var Flow $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 = FlowsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]');

    list_flows_sample($formattedParent);
} 

trainFlow

Trains the specified flow. Note that only the flow in 'draft' environment is trained.

This method is a long-running operation . The returned Operation type has the following method-specific fields:

Note: You should always train a flow prior to sending it queries. See the training documentation .

Parameters
Name
Description
name
string

Required. The flow to train. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID> .

optionalArgs
array

Optional.

↳ retrySettings
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.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Dialogflow\Cx\V3\FlowsClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName The flow to train.
 *                              Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
 *                              ID>/flows/<Flow ID>`. Please see
 *                              {@see FlowsClient::flowName()} for help formatting this field.
 */
function train_flow_sample(string $formattedName): void
{
    // Create a client.
    $flowsClient = new FlowsClient();

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

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } 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 = FlowsClient::flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]');

    train_flow_sample($formattedName);
} 

updateFlow

Updates the specified flow.

Note: You should always train a flow prior to sending it queries. See the training documentation .

Parameters
Name
Description
flow
Google\Cloud\Dialogflow\Cx\V3\Flow

Required. The flow to update.

optionalArgs
array

Optional.

↳ updateMask
FieldMask

The mask to control which fields get updated. If the mask is not present, all fields will be updated.

↳ languageCode
string

The language of the following fields in flow : * Flow.event_handlers.trigger_fulfillment.messages * Flow.event_handlers.trigger_fulfillment.conditional_cases * Flow.transition_routes.trigger_fulfillment.messages * Flow.transition_routes.trigger_fulfillment.conditional_cases If not specified, the agent's default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.

↳ retrySettings
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.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Dialogflow\Cx\V3\Flow;
use Google\Cloud\Dialogflow\Cx\V3\FlowsClient;

/**
 * @param string $flowDisplayName The human-readable name of the flow.
 */
function update_flow_sample(string $flowDisplayName): void
{
    // Create a client.
    $flowsClient = new FlowsClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $flow = (new Flow())
        ->setDisplayName($flowDisplayName);

    // Call the API and handle any network failures.
    try {
        /** @var Flow $response */
        $response = $flowsClient->updateFlow($flow);
        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
{
    $flowDisplayName = '[DISPLAY_NAME]';

    update_flow_sample($flowDisplayName);
} 

validateFlow

Validates the specified flow and creates or updates validation results.

Please call this API after the training is completed to get the complete validation results.

Parameters
Name
Description
name
string

Required. The flow to validate. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID> .

optionalArgs
array

Optional.

↳ languageCode
string

If not specified, the agent's default language is used.

↳ retrySettings
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.

Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Dialogflow\Cx\V3\FlowValidationResult;
use Google\Cloud\Dialogflow\Cx\V3\FlowsClient;

/**
 * @param string $formattedName The flow to validate.
 *                              Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
 *                              ID>/flows/<Flow ID>`. Please see
 *                              {@see FlowsClient::flowName()} for help formatting this field.
 */
function validate_flow_sample(string $formattedName): void
{
    // Create a client.
    $flowsClient = new FlowsClient();

    // Call the API and handle any network failures.
    try {
        /** @var FlowValidationResult $response */
        $response = $flowsClient->validateFlow($formattedName);
        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 = FlowsClient::flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]');

    validate_flow_sample($formattedName);
} 

getLocation

Gets information about a location.

Parameters
Name
Description
optionalArgs
array

Optional.

↳ name
string

Resource name for the location.

↳ retrySettings
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.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Dialogflow\Cx\V3\FlowsClient;
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.
    $flowsClient = new FlowsClient();

    // Call the API and handle any network failures.
    try {
        /** @var Location $response */
        $response = $flowsClient->getLocation();
        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.

Parameters
Name
Description
optionalArgs
array

Optional.

↳ name
string

The resource that owns the locations collection, if applicable.

↳ filter
string

The standard list filter.

↳ pageSize
int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken
string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings
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.

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Dialogflow\Cx\V3\FlowsClient;
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.
    $flowsClient = new FlowsClient();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $flowsClient->listLocations();

        /** @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());
    }
} 

getOperationsClient

Return an OperationsClient object with the same endpoint as $this.

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.

Parameters
Name
Description
operationName
string

The name of the long running operation

methodName
string

The name of the method used to start the operation

Returns
Type
Description

static::agentName

Formats a string containing the fully-qualified path to represent a agent resource.

Parameters
Name
Description
project
string
location
string
agent
string
Returns
Type
Description
string
The formatted agent resource.

static::flowName

Formats a string containing the fully-qualified path to represent a flow resource.

Parameters
Name
Description
project
string
location
string
agent
string
flow
string
Returns
Type
Description
string
The formatted flow resource.

static::flowValidationResultName

Formats a string containing the fully-qualified path to represent a flow_validation_result resource.

Parameters
Name
Description
project
string
location
string
agent
string
flow
string
Returns
Type
Description
string
The formatted flow_validation_result resource.

static::intentName

Formats a string containing the fully-qualified path to represent a intent resource.

Parameters
Name
Description
project
string
location
string
agent
string
intent
string
Returns
Type
Description
string
The formatted intent resource.

static::pageName

Formats a string containing the fully-qualified path to represent a page resource.

Parameters
Name
Description
project
string
location
string
agent
string
flow
string
page
string
Returns
Type
Description
string
The formatted page resource.

static::projectLocationAgentFlowTransitionRouteGroupName

Formats a string containing the fully-qualified path to represent a project_location_agent_flow_transition_route_group resource.

Parameters
Name
Description
project
string
location
string
agent
string
flow
string
transitionRouteGroup
string
Returns
Type
Description
string
The formatted project_location_agent_flow_transition_route_group resource.

static::projectLocationAgentTransitionRouteGroupName

Formats a string containing the fully-qualified path to represent a project_location_agent_transition_route_group resource.

Parameters
Name
Description
project
string
location
string
agent
string
transitionRouteGroup
string
Returns
Type
Description
string
The formatted project_location_agent_transition_route_group resource.

static::transitionRouteGroupName

Formats a string containing the fully-qualified path to represent a transition_route_group resource.

Parameters
Name
Description
project
string
location
string
agent
string
flow
string
transitionRouteGroup
string
Returns
Type
Description
string
The formatted transition_route_group resource.

static::webhookName

Formats a string containing the fully-qualified path to represent a webhook resource.

Parameters
Name
Description
project
string
location
string
agent
string
webhook
string
Returns
Type
Description
string
The formatted webhook resource.

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}
  • flow: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}
  • flowValidationResult: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/validationResult
  • intent: projects/{project}/locations/{location}/agents/{agent}/intents/{intent}
  • page: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}
  • projectLocationAgentFlowTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}
  • projectLocationAgentTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group}
  • transitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}
  • 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.

Parameters
Name
Description
formattedName
string

The formatted name string

template
string

Optional name of template to match

Returns
Type
Description
array
An associative array from name component IDs to component values.

Constants

SERVICE_NAME

  Value: 'google.cloud.dialogflow.cx.v3.Flows' 
 

The name of the service.

SERVICE_ADDRESS

  Value: 'dialogflow.googleapis.com' 
 

The default address of the service.

DEFAULT_SERVICE_PORT

  Value: 443 
 

The default port of the service.

CODEGEN_NAME

  Value: 'gapic' 
 

The name of the code generator, to be included in the agent header.

Design a Mobile Site
View Site in Mobile | Classic
Share by: