Google Cloud Video Stitcher V1 Client - Class VideoStitcherServiceClient (0.7.3)

Reference documentation and code samples for the Google Cloud Video Stitcher V1 Client class VideoStitcherServiceClient.

Service Description: Video-On-Demand content stitching API allows you to insert ads into (VoD) video on demand files. You will be able to render custom scrubber bars with highlighted ads, enforce ad policies, allow seamless playback and tracking on native players and monetize content with any standard VMAP compliant ad server.

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:

$videoStitcherServiceClient = new VideoStitcherServiceClient();
try {
    $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]');
    $cdnKey = new CdnKey();
    $cdnKeyId = 'cdn_key_id';
    $operationResponse = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId);
    $operationResponse->pollUntilComplete();
    if ($operationResponse->operationSucceeded()) {
        $result = $operationResponse->getResult();
    // doSomethingWith($result)
    } else {
        $error = $operationResponse->getError();
        // handleError($error)
    }
    // Alternatively:
    // start the operation, keep the operation name, and resume later
    $operationResponse = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId);
    $operationName = $operationResponse->getName();
    // ... do other work
    $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'createCdnKey');
    while (!$newOperationResponse->isDone()) {
        // ... do other work
        $newOperationResponse->reload();
    }
    if ($newOperationResponse->operationSucceeded()) {
        $result = $newOperationResponse->getResult();
    // doSomethingWith($result)
    } else {
        $error = $newOperationResponse->getError();
        // handleError($error)
    }
} finally {
    $videoStitcherServiceClient->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.

This service has a new (beta) implementation. See Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient to use the new surface.

Namespace

Google \ Cloud \ Video \ Stitcher \ V1

Methods

__construct

Constructor.

Parameters
NameDescription
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.

createCdnKey

Creates a new CDN key.

Parameters
NameDescription
parent string

Required. The project in which the CDN key should be created, in the form of projects/{project_number}/locations/{location}.

cdnKey Google\Cloud\Video\Stitcher\V1\CdnKey

Required. The CDN key resource to create.

cdnKeyId string

Required. The ID to use for the CDN key, which will become the final component of the CDN key's resource name.

This value should conform to RFC-1034, which restricts to lower-case letters, numbers, and hyphen, with the first character a letter, the last a letter or a number, and a 63 character maximum.

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
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\Stitcher\V1\CdnKey;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\CreateCdnKeyRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The project in which the CDN key should be created, in the form
 *                                of `projects/{project_number}/locations/{location}`. Please see
 *                                {@see VideoStitcherServiceClient::locationName()} for help formatting this field.
 * @param string $cdnKeyId        The ID to use for the CDN key, which will become the final
 *                                component of the CDN key's resource name.
 *
 *                                This value should conform to RFC-1034, which restricts to
 *                                lower-case letters, numbers, and hyphen, with the first character a
 *                                letter, the last a letter or a number, and a 63 character maximum.
 */
function create_cdn_key_sample(string $formattedParent, string $cdnKeyId): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

    // Prepare the request message.
    $cdnKey = new CdnKey();
    $request = (new CreateCdnKeyRequest())
        ->setParent($formattedParent)
        ->setCdnKey($cdnKey)
        ->setCdnKeyId($cdnKeyId);

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

        if ($response->operationSucceeded()) {
            /** @var CdnKey $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 = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]');
    $cdnKeyId = '[CDN_KEY_ID]';

    create_cdn_key_sample($formattedParent, $cdnKeyId);
}

createLiveConfig

Registers the live config with the provided unique ID in the specified region.

Parameters
NameDescription
parent string

Required. The project in which the live config should be created, in the form of projects/{project_number}/locations/{location}.

liveConfigId string

Required. The unique identifier ID to use for the live config.

liveConfig Google\Cloud\Video\Stitcher\V1\LiveConfig

Required. The live config resource to create.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\Stitcher\V1\AdTracking;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\CreateLiveConfigRequest;
use Google\Cloud\Video\Stitcher\V1\LiveConfig;
use Google\Rpc\Status;

/**
 * @param string $formattedParent      The project in which the live config should be created, in
 *                                     the form of `projects/{project_number}/locations/{location}`. Please see
 *                                     {@see VideoStitcherServiceClient::locationName()} for help formatting this field.
 * @param string $liveConfigId         The unique identifier ID to use for the live config.
 * @param string $liveConfigSourceUri  Source URI for the live stream manifest.
 * @param int    $liveConfigAdTracking Determines how the ads are tracked. If
 *                                     [gam_live_config][google.cloud.video.stitcher.v1.LiveConfig.gam_live_config]
 *                                     is set, the value must be `CLIENT` because the IMA SDK handles ad tracking.
 */
function create_live_config_sample(
    string $formattedParent,
    string $liveConfigId,
    string $liveConfigSourceUri,
    int $liveConfigAdTracking
): void {
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

    // Prepare the request message.
    $liveConfig = (new LiveConfig())
        ->setSourceUri($liveConfigSourceUri)
        ->setAdTracking($liveConfigAdTracking);
    $request = (new CreateLiveConfigRequest())
        ->setParent($formattedParent)
        ->setLiveConfigId($liveConfigId)
        ->setLiveConfig($liveConfig);

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

        if ($response->operationSucceeded()) {
            /** @var LiveConfig $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 = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]');
    $liveConfigId = '[LIVE_CONFIG_ID]';
    $liveConfigSourceUri = '[SOURCE_URI]';
    $liveConfigAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED;

    create_live_config_sample(
        $formattedParent,
        $liveConfigId,
        $liveConfigSourceUri,
        $liveConfigAdTracking
    );
}

createLiveSession

Creates a new live session.

Parameters
NameDescription
parent string

Required. The project and location in which the live session should be created, in the form of projects/{project_number}/locations/{location}.

liveSession Google\Cloud\Video\Stitcher\V1\LiveSession

Required. Parameters for creating a live session.

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
TypeDescription
Google\Cloud\Video\Stitcher\V1\LiveSession
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\CreateLiveSessionRequest;
use Google\Cloud\Video\Stitcher\V1\LiveSession;

/**
 * @param string $formattedParent                The project and location in which the live session should be
 *                                               created, in the form of `projects/{project_number}/locations/{location}`. Please see
 *                                               {@see VideoStitcherServiceClient::locationName()} for help formatting this field.
 * @param string $formattedLiveSessionLiveConfig The resource name of the live config for this session, in the
 *                                               form of `projects/{project}/locations/{location}/liveConfigs/{id}`. Please see
 *                                               {@see VideoStitcherServiceClient::liveConfigName()} for help formatting this field.
 */
function create_live_session_sample(
    string $formattedParent,
    string $formattedLiveSessionLiveConfig
): void {
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

    // Prepare the request message.
    $liveSession = (new LiveSession())
        ->setLiveConfig($formattedLiveSessionLiveConfig);
    $request = (new CreateLiveSessionRequest())
        ->setParent($formattedParent)
        ->setLiveSession($liveSession);

    // Call the API and handle any network failures.
    try {
        /** @var LiveSession $response */
        $response = $videoStitcherServiceClient->createLiveSession($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 = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]');
    $formattedLiveSessionLiveConfig = VideoStitcherServiceClient::liveConfigName(
        '[PROJECT]',
        '[LOCATION]',
        '[LIVE_CONFIG]'
    );

    create_live_session_sample($formattedParent, $formattedLiveSessionLiveConfig);
}

createSlate

Creates a slate.

Parameters
NameDescription
parent string

Required. The project in which the slate should be created, in the form of projects/{project_number}/locations/{location}.

slateId string

Required. The unique identifier for the slate. This value should conform to RFC-1034, which restricts to lower-case letters, numbers, and hyphen, with the first character a letter, the last a letter or a number, and a 63 character maximum.

slate Google\Cloud\Video\Stitcher\V1\Slate

Required. The slate to create.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\CreateSlateRequest;
use Google\Cloud\Video\Stitcher\V1\Slate;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The project in which the slate should be created, in the form of
 *                                `projects/{project_number}/locations/{location}`. Please see
 *                                {@see VideoStitcherServiceClient::locationName()} for help formatting this field.
 * @param string $slateId         The unique identifier for the slate.
 *                                This value should conform to RFC-1034, which restricts to
 *                                lower-case letters, numbers, and hyphen, with the first character a
 *                                letter, the last a letter or a number, and a 63 character maximum.
 */
function create_slate_sample(string $formattedParent, string $slateId): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

    // Prepare the request message.
    $slate = new Slate();
    $request = (new CreateSlateRequest())
        ->setParent($formattedParent)
        ->setSlateId($slateId)
        ->setSlate($slate);

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

        if ($response->operationSucceeded()) {
            /** @var Slate $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 = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]');
    $slateId = '[SLATE_ID]';

    create_slate_sample($formattedParent, $slateId);
}

createVodSession

Creates a client side playback VOD session and returns the full tracking and playback metadata of the session.

Parameters
NameDescription
parent string

Required. The project and location in which the VOD session should be created, in the form of projects/{project_number}/locations/{location}.

vodSession Google\Cloud\Video\Stitcher\V1\VodSession

Required. Parameters for creating a session.

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
TypeDescription
Google\Cloud\Video\Stitcher\V1\VodSession
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Video\Stitcher\V1\AdTracking;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\CreateVodSessionRequest;
use Google\Cloud\Video\Stitcher\V1\VodSession;

/**
 * @param string $formattedParent      The project and location in which the VOD session should be
 *                                     created, in the form of `projects/{project_number}/locations/{location}`. Please see
 *                                     {@see VideoStitcherServiceClient::locationName()} for help formatting this field.
 * @param string $vodSessionSourceUri  URI of the media to stitch.
 * @param string $vodSessionAdTagUri   Ad tag URI.
 * @param int    $vodSessionAdTracking Determines how the ad should be tracked.
 */
function create_vod_session_sample(
    string $formattedParent,
    string $vodSessionSourceUri,
    string $vodSessionAdTagUri,
    int $vodSessionAdTracking
): void {
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

    // Prepare the request message.
    $vodSession = (new VodSession())
        ->setSourceUri($vodSessionSourceUri)
        ->setAdTagUri($vodSessionAdTagUri)
        ->setAdTracking($vodSessionAdTracking);
    $request = (new CreateVodSessionRequest())
        ->setParent($formattedParent)
        ->setVodSession($vodSession);

    // Call the API and handle any network failures.
    try {
        /** @var VodSession $response */
        $response = $videoStitcherServiceClient->createVodSession($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 = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]');
    $vodSessionSourceUri = '[SOURCE_URI]';
    $vodSessionAdTagUri = '[AD_TAG_URI]';
    $vodSessionAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED;

    create_vod_session_sample(
        $formattedParent,
        $vodSessionSourceUri,
        $vodSessionAdTagUri,
        $vodSessionAdTracking
    );
}

deleteCdnKey

Deletes the specified CDN key.

Parameters
NameDescription
name string

Required. The name of the CDN key to be deleted, in the form of projects/{project_number}/locations/{location}/cdnKeys/{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
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\DeleteCdnKeyRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the CDN key to be deleted, in the form of
 *                              `projects/{project_number}/locations/{location}/cdnKeys/{id}`. Please see
 *                              {@see VideoStitcherServiceClient::cdnKeyName()} for help formatting this field.
 */
function delete_cdn_key_sample(string $formattedName): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $videoStitcherServiceClient->deleteCdnKey($request);
        $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 = VideoStitcherServiceClient::cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]');

    delete_cdn_key_sample($formattedName);
}

deleteLiveConfig

Deletes the specified live config.

Parameters
NameDescription
name string

Required. The name of the live config to be deleted, in the form of projects/{project_number}/locations/{location}/liveConfigs/{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
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\DeleteLiveConfigRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the live config to be deleted, in the form of
 *                              `projects/{project_number}/locations/{location}/liveConfigs/{id}`. Please see
 *                              {@see VideoStitcherServiceClient::liveConfigName()} for help formatting this field.
 */
function delete_live_config_sample(string $formattedName): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $videoStitcherServiceClient->deleteLiveConfig($request);
        $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 = VideoStitcherServiceClient::liveConfigName(
        '[PROJECT]',
        '[LOCATION]',
        '[LIVE_CONFIG]'
    );

    delete_live_config_sample($formattedName);
}

deleteSlate

Deletes the specified slate.

Parameters
NameDescription
name string

Required. The name of the slate to be deleted, in the form of projects/{project_number}/locations/{location}/slates/{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
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\DeleteSlateRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the slate to be deleted, in the form of
 *                              `projects/{project_number}/locations/{location}/slates/{id}`. Please see
 *                              {@see VideoStitcherServiceClient::slateName()} for help formatting this field.
 */
function delete_slate_sample(string $formattedName): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $videoStitcherServiceClient->deleteSlate($request);
        $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 = VideoStitcherServiceClient::slateName('[PROJECT]', '[LOCATION]', '[SLATE]');

    delete_slate_sample($formattedName);
}

getCdnKey

Returns the specified CDN key.

Parameters
NameDescription
name string

Required. The name of the CDN key to be retrieved, in the form of projects/{project}/locations/{location}/cdnKeys/{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
TypeDescription
Google\Cloud\Video\Stitcher\V1\CdnKey
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Video\Stitcher\V1\CdnKey;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\GetCdnKeyRequest;

/**
 * @param string $formattedName The name of the CDN key to be retrieved, in the form of
 *                              `projects/{project}/locations/{location}/cdnKeys/{id}`. Please see
 *                              {@see VideoStitcherServiceClient::cdnKeyName()} for help formatting this field.
 */
function get_cdn_key_sample(string $formattedName): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var CdnKey $response */
        $response = $videoStitcherServiceClient->getCdnKey($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 = VideoStitcherServiceClient::cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]');

    get_cdn_key_sample($formattedName);
}

getLiveAdTagDetail

Returns the specified ad tag detail for the specified live session.

Parameters
NameDescription
name string

Required. The resource name in the form of projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail}.

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
TypeDescription
Google\Cloud\Video\Stitcher\V1\LiveAdTagDetail
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\GetLiveAdTagDetailRequest;
use Google\Cloud\Video\Stitcher\V1\LiveAdTagDetail;

/**
 * @param string $formattedName The resource name in the form of
 *                              `projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail}`. Please see
 *                              {@see VideoStitcherServiceClient::liveAdTagDetailName()} for help formatting this field.
 */
function get_live_ad_tag_detail_sample(string $formattedName): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var LiveAdTagDetail $response */
        $response = $videoStitcherServiceClient->getLiveAdTagDetail($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 = VideoStitcherServiceClient::liveAdTagDetailName(
        '[PROJECT]',
        '[LOCATION]',
        '[LIVE_SESSION]',
        '[LIVE_AD_TAG_DETAIL]'
    );

    get_live_ad_tag_detail_sample($formattedName);
}

getLiveConfig

Returns the specified live config managed by the Video Stitcher service.

Parameters
NameDescription
name string

Required. The name of the live config to be retrieved, in the form of projects/{project_number}/locations/{location}/liveConfigs/{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
TypeDescription
Google\Cloud\Video\Stitcher\V1\LiveConfig
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\GetLiveConfigRequest;
use Google\Cloud\Video\Stitcher\V1\LiveConfig;

/**
 * @param string $formattedName The name of the live config to be retrieved, in the form
 *                              of
 *                              `projects/{project_number}/locations/{location}/liveConfigs/{id}`. Please see
 *                              {@see VideoStitcherServiceClient::liveConfigName()} for help formatting this field.
 */
function get_live_config_sample(string $formattedName): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var LiveConfig $response */
        $response = $videoStitcherServiceClient->getLiveConfig($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 = VideoStitcherServiceClient::liveConfigName(
        '[PROJECT]',
        '[LOCATION]',
        '[LIVE_CONFIG]'
    );

    get_live_config_sample($formattedName);
}

getLiveSession

Returns the details for the specified live session.

Parameters
NameDescription
name string

Required. The name of the live session, in the form of projects/{project_number}/locations/{location}/liveSessions/{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
TypeDescription
Google\Cloud\Video\Stitcher\V1\LiveSession
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\GetLiveSessionRequest;
use Google\Cloud\Video\Stitcher\V1\LiveSession;

/**
 * @param string $formattedName The name of the live session, in the form of
 *                              `projects/{project_number}/locations/{location}/liveSessions/{id}`. Please see
 *                              {@see VideoStitcherServiceClient::liveSessionName()} for help formatting this field.
 */
function get_live_session_sample(string $formattedName): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var LiveSession $response */
        $response = $videoStitcherServiceClient->getLiveSession($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 = VideoStitcherServiceClient::liveSessionName(
        '[PROJECT]',
        '[LOCATION]',
        '[LIVE_SESSION]'
    );

    get_live_session_sample($formattedName);
}

getSlate

Returns the specified slate.

Parameters
NameDescription
name string

Required. The name of the slate to be retrieved, of the slate, in the form of projects/{project_number}/locations/{location}/slates/{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
TypeDescription
Google\Cloud\Video\Stitcher\V1\Slate
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\GetSlateRequest;
use Google\Cloud\Video\Stitcher\V1\Slate;

/**
 * @param string $formattedName The name of the slate to be retrieved, of the slate, in the form
 *                              of `projects/{project_number}/locations/{location}/slates/{id}`. Please see
 *                              {@see VideoStitcherServiceClient::slateName()} for help formatting this field.
 */
function get_slate_sample(string $formattedName): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Slate $response */
        $response = $videoStitcherServiceClient->getSlate($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 = VideoStitcherServiceClient::slateName('[PROJECT]', '[LOCATION]', '[SLATE]');

    get_slate_sample($formattedName);
}

getVodAdTagDetail

Returns the specified ad tag detail for the specified VOD session.

Parameters
NameDescription
name string

Required. The name of the ad tag detail for the specified VOD session, in the form of projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{vod_ad_tag_detail}.

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
TypeDescription
Google\Cloud\Video\Stitcher\V1\VodAdTagDetail
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\GetVodAdTagDetailRequest;
use Google\Cloud\Video\Stitcher\V1\VodAdTagDetail;

/**
 * @param string $formattedName The name of the ad tag detail for the specified VOD session, in
 *                              the form of
 *                              `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{vod_ad_tag_detail}`. Please see
 *                              {@see VideoStitcherServiceClient::vodAdTagDetailName()} for help formatting this field.
 */
function get_vod_ad_tag_detail_sample(string $formattedName): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var VodAdTagDetail $response */
        $response = $videoStitcherServiceClient->getVodAdTagDetail($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 = VideoStitcherServiceClient::vodAdTagDetailName(
        '[PROJECT]',
        '[LOCATION]',
        '[VOD_SESSION]',
        '[VOD_AD_TAG_DETAIL]'
    );

    get_vod_ad_tag_detail_sample($formattedName);
}

getVodSession

Returns the full tracking, playback metadata, and relevant ad-ops logs for the specified VOD session.

Parameters
NameDescription
name string

Required. The name of the VOD session to be retrieved, in the form of projects/{project_number}/locations/{location}/vodSessions/{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
TypeDescription
Google\Cloud\Video\Stitcher\V1\VodSession
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\GetVodSessionRequest;
use Google\Cloud\Video\Stitcher\V1\VodSession;

/**
 * @param string $formattedName The name of the VOD session to be retrieved, in the form of
 *                              `projects/{project_number}/locations/{location}/vodSessions/{id}`. Please see
 *                              {@see VideoStitcherServiceClient::vodSessionName()} for help formatting this field.
 */
function get_vod_session_sample(string $formattedName): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var VodSession $response */
        $response = $videoStitcherServiceClient->getVodSession($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 = VideoStitcherServiceClient::vodSessionName(
        '[PROJECT]',
        '[LOCATION]',
        '[VOD_SESSION]'
    );

    get_vod_session_sample($formattedName);
}

getVodStitchDetail

Returns the specified stitching information for the specified VOD session.

Parameters
NameDescription
name string

Required. The name of the stitch detail in the specified VOD session, in the form of projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{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
TypeDescription
Google\Cloud\Video\Stitcher\V1\VodStitchDetail
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\GetVodStitchDetailRequest;
use Google\Cloud\Video\Stitcher\V1\VodStitchDetail;

/**
 * @param string $formattedName The name of the stitch detail in the specified VOD session, in
 *                              the form of
 *                              `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. Please see
 *                              {@see VideoStitcherServiceClient::vodStitchDetailName()} for help formatting this field.
 */
function get_vod_stitch_detail_sample(string $formattedName): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var VodStitchDetail $response */
        $response = $videoStitcherServiceClient->getVodStitchDetail($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 = VideoStitcherServiceClient::vodStitchDetailName(
        '[PROJECT]',
        '[LOCATION]',
        '[VOD_SESSION]',
        '[VOD_STITCH_DETAIL]'
    );

    get_vod_stitch_detail_sample($formattedName);
}

listCdnKeys

Lists all CDN keys in the specified project and location.

Parameters
NameDescription
parent string

Required. The project that contains the list of CDN keys, in the form of projects/{project_number}/locations/{location}.

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.

↳ filter string

Filtering results

↳ orderBy string

Hint for how to order the results

↳ 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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Video\Stitcher\V1\CdnKey;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\ListCdnKeysRequest;

/**
 * @param string $formattedParent The project that contains the list of CDN keys, in the form of
 *                                `projects/{project_number}/locations/{location}`. Please see
 *                                {@see VideoStitcherServiceClient::locationName()} for help formatting this field.
 */
function list_cdn_keys_sample(string $formattedParent): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

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

        /** @var CdnKey $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 = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]');

    list_cdn_keys_sample($formattedParent);
}

listLiveAdTagDetails

Return the list of ad tag details for the specified live session.

Parameters
NameDescription
parent string

Required. The resource parent in the form of projects/{project}/locations/{location}/liveSessions/{live_session}.

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.

↳ 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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\ListLiveAdTagDetailsRequest;
use Google\Cloud\Video\Stitcher\V1\LiveAdTagDetail;

/**
 * @param string $formattedParent The resource parent in the form of
 *                                `projects/{project}/locations/{location}/liveSessions/{live_session}`. Please see
 *                                {@see VideoStitcherServiceClient::liveSessionName()} for help formatting this field.
 */
function list_live_ad_tag_details_sample(string $formattedParent): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

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

        /** @var LiveAdTagDetail $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 = VideoStitcherServiceClient::liveSessionName(
        '[PROJECT]',
        '[LOCATION]',
        '[LIVE_SESSION]'
    );

    list_live_ad_tag_details_sample($formattedParent);
}

listLiveConfigs

Lists all live configs managed by the Video Stitcher that belong to the specified project and region.

Parameters
NameDescription
parent string

Required. The project that contains the list of live configs, in the form of projects/{project_number}/locations/{location}.

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.

↳ filter string

Optional. The filter to apply to list results (see Filtering).

↳ orderBy string

Optional. Specifies the ordering of results following Cloud API syntax.

↳ 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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\ListLiveConfigsRequest;
use Google\Cloud\Video\Stitcher\V1\LiveConfig;

/**
 * @param string $formattedParent The project that contains the list of live configs, in the
 *                                form of `projects/{project_number}/locations/{location}`. Please see
 *                                {@see VideoStitcherServiceClient::locationName()} for help formatting this field.
 */
function list_live_configs_sample(string $formattedParent): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

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

        /** @var LiveConfig $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 = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]');

    list_live_configs_sample($formattedParent);
}

listSlates

Lists all slates in the specified project and location.

Parameters
NameDescription
parent string

Required. The project to list slates, in the form of projects/{project_number}/locations/{location}.

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.

↳ filter string

Filtering results

↳ orderBy string

Hint for how to order the results

↳ 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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\ListSlatesRequest;
use Google\Cloud\Video\Stitcher\V1\Slate;

/**
 * @param string $formattedParent The project to list slates, in the form of
 *                                `projects/{project_number}/locations/{location}`. Please see
 *                                {@see VideoStitcherServiceClient::locationName()} for help formatting this field.
 */
function list_slates_sample(string $formattedParent): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

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

        /** @var Slate $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 = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]');

    list_slates_sample($formattedParent);
}

listVodAdTagDetails

Return the list of ad tag details for the specified VOD session.

Parameters
NameDescription
parent string

Required. The VOD session which the ad tag details belong to, in the form of projects/{project}/locations/{location}/vodSessions/{vod_session_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.

↳ 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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\ListVodAdTagDetailsRequest;
use Google\Cloud\Video\Stitcher\V1\VodAdTagDetail;

/**
 * @param string $formattedParent The VOD session which the ad tag details belong to, in the form
 *                                of `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. Please see
 *                                {@see VideoStitcherServiceClient::vodSessionName()} for help formatting this field.
 */
function list_vod_ad_tag_details_sample(string $formattedParent): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

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

        /** @var VodAdTagDetail $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 = VideoStitcherServiceClient::vodSessionName(
        '[PROJECT]',
        '[LOCATION]',
        '[VOD_SESSION]'
    );

    list_vod_ad_tag_details_sample($formattedParent);
}

listVodStitchDetails

Returns a list of detailed stitching information of the specified VOD session.

Parameters
NameDescription
parent string

Required. The VOD session where the stitch details belong to, in the form of projects/{project}/locations/{location}/vodSessions/{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.

↳ 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
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\ListVodStitchDetailsRequest;
use Google\Cloud\Video\Stitcher\V1\VodStitchDetail;

/**
 * @param string $formattedParent The VOD session where the stitch details belong to, in the form
 *                                of `projects/{project}/locations/{location}/vodSessions/{id}`. Please see
 *                                {@see VideoStitcherServiceClient::vodSessionName()} for help formatting this field.
 */
function list_vod_stitch_details_sample(string $formattedParent): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

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

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

        /** @var VodStitchDetail $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 = VideoStitcherServiceClient::vodSessionName(
        '[PROJECT]',
        '[LOCATION]',
        '[VOD_SESSION]'
    );

    list_vod_stitch_details_sample($formattedParent);
}

updateCdnKey

Updates the specified CDN key. Only update fields specified in the call method body.

Parameters
NameDescription
cdnKey Google\Cloud\Video\Stitcher\V1\CdnKey

Required. The CDN key resource which replaces the resource on the server.

updateMask Google\Protobuf\FieldMask

Required. The update mask applies to the resource. For the FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask

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
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\Stitcher\V1\CdnKey;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\UpdateCdnKeyRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * 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 update_cdn_key_sample(): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

    // Prepare the request message.
    $cdnKey = new CdnKey();
    $updateMask = new FieldMask();
    $request = (new UpdateCdnKeyRequest())
        ->setCdnKey($cdnKey)
        ->setUpdateMask($updateMask);

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

        if ($response->operationSucceeded()) {
            /** @var CdnKey $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());
    }
}

updateSlate

Updates the specified slate.

Parameters
NameDescription
slate Google\Cloud\Video\Stitcher\V1\Slate

Required. The resource with updated fields.

updateMask Google\Protobuf\FieldMask

Required. The update mask which specifies fields which should be updated.

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
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\Slate;
use Google\Cloud\Video\Stitcher\V1\UpdateSlateRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * 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 update_slate_sample(): void
{
    // Create a client.
    $videoStitcherServiceClient = new VideoStitcherServiceClient();

    // Prepare the request message.
    $slate = new Slate();
    $updateMask = new FieldMask();
    $request = (new UpdateSlateRequest())
        ->setSlate($slate)
        ->setUpdateMask($updateMask);

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

        if ($response->operationSucceeded()) {
            /** @var Slate $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());
    }
}

getOperationsClient

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

Returns
TypeDescription
Google\ApiCore\LongRunning\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.

Parameters
NameDescription
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
TypeDescription
Google\ApiCore\OperationResponse

static::cdnKeyName

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

Parameters
NameDescription
project string
location string
cdnKey string
Returns
TypeDescription
stringThe formatted cdn_key resource.

static::liveAdTagDetailName

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

Parameters
NameDescription
project string
location string
liveSession string
liveAdTagDetail string
Returns
TypeDescription
stringThe formatted live_ad_tag_detail resource.

static::liveConfigName

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

Parameters
NameDescription
project string
location string
liveConfig string
Returns
TypeDescription
stringThe formatted live_config resource.

static::liveSessionName

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

Parameters
NameDescription
project string
location string
liveSession string
Returns
TypeDescription
stringThe formatted live_session resource.

static::locationName

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

Parameters
NameDescription
project string
location string
Returns
TypeDescription
stringThe formatted location resource.

static::slateName

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

Parameters
NameDescription
project string
location string
slate string
Returns
TypeDescription
stringThe formatted slate resource.

static::vodAdTagDetailName

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

Parameters
NameDescription
project string
location string
vodSession string
vodAdTagDetail string
Returns
TypeDescription
stringThe formatted vod_ad_tag_detail resource.

static::vodSessionName

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

Parameters
NameDescription
project string
location string
vodSession string
Returns
TypeDescription
stringThe formatted vod_session resource.

static::vodStitchDetailName

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

Parameters
NameDescription
project string
location string
vodSession string
vodStitchDetail string
Returns
TypeDescription
stringThe formatted vod_stitch_detail 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

  • cdnKey: projects/{project}/locations/{location}/cdnKeys/{cdn_key}
  • liveAdTagDetail: projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail}
  • liveConfig: projects/{project}/locations/{location}/liveConfigs/{live_config}
  • liveSession: projects/{project}/locations/{location}/liveSessions/{live_session}
  • location: projects/{project}/locations/{location}
  • slate: projects/{project}/locations/{location}/slates/{slate}
  • vodAdTagDetail: projects/{project}/locations/{location}/vodSessions/{vod_session}/vodAdTagDetails/{vod_ad_tag_detail}
  • vodSession: projects/{project}/locations/{location}/vodSessions/{vod_session}
  • vodStitchDetail: projects/{project}/locations/{location}/vodSessions/{vod_session}/vodStitchDetails/{vod_stitch_detail}

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
NameDescription
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
TypeDescription
arrayAn associative array from name component IDs to component values.

Constants

SERVICE_NAME

Value: 'google.cloud.video.stitcher.v1.VideoStitcherService'

The name of the service.

SERVICE_ADDRESS

Value: 'videostitcher.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.