Google Ads Ad Manager V1 Client - Class DaiEncodingProfileServiceClient (0.14.1)

Reference documentation and code samples for the Google Ads Ad Manager V1 Client class DaiEncodingProfileServiceClient.

Service Description: Provides methods for handling DaiEncodingProfile objects.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.

Namespace

Google \ Ads \ AdManager \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name Description
options array|Google\ApiCore\Options\ClientOptions

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials Google\Auth\FetchAuthTokenInterface|Google\ApiCore\CredentialsWrapper

This option should only be used with a pre-constructed Google\Auth\FetchAuthTokenInterface or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. Important: If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly use Google\Auth\Credentials\ServiceAccountCredentials; use Google\Ads\AdManager\V1\DaiEncodingProfileServiceClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new DaiEncodingProfileServiceClient(['credentials' => $creds]); https://cloud.google.com/docs/authentication/external/externally-sourced-credentials

↳ credentialsConfig array

Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .

↳ disableRetries bool

Determines whether or not retries defined by the client configuration should be disabled. Defaults to false.

↳ clientConfig string|array

Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder.

↳ transport string|Google\ApiCore\Transport\TransportInterface

The transport used for executing network requests. At the moment, supports only rest. 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 = [ 'rest' => [...], ]; See the Google\ApiCore\Transport\RestTransport::build() method for the supported options.

↳ clientCertSource callable

A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS.

↳ logger false|Psr\Log\LoggerInterface

A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag

↳ universeDomain string

The service domain for the client. Defaults to 'googleapis.com'.

batchActivateDaiEncodingProfiles

Activates a list of DaiEncodingProfile objects.

The async variant is DaiEncodingProfileServiceClient::batchActivateDaiEncodingProfilesAsync() .

Parameters
Name Description
request Google\Ads\AdManager\V1\BatchActivateDaiEncodingProfilesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Ads\AdManager\V1\BatchActivateDaiEncodingProfilesResponse
Example
use Google\Ads\AdManager\V1\ActivateDaiEncodingProfileRequest;
use Google\Ads\AdManager\V1\BatchActivateDaiEncodingProfilesRequest;
use Google\Ads\AdManager\V1\BatchActivateDaiEncodingProfilesResponse;
use Google\Ads\AdManager\V1\Client\DaiEncodingProfileServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       Format: `networks/{network_code}`
 *                                      Please see {@see DaiEncodingProfileServiceClient::networkName()} for help formatting this field.
 * @param string $formattedRequestsName The resource name of the DaiEncodingProfile to activate.
 *                                      Format:
 *                                      `networks/{network_code}/daiEncodingProfiles/{dai_encoding_profile_id}`
 *                                      Please see {@see DaiEncodingProfileServiceClient::daiEncodingProfileName()} for help formatting this field.
 */
function batch_activate_dai_encoding_profiles_sample(
    string $formattedParent,
    string $formattedRequestsName
): void {
    // Create a client.
    $daiEncodingProfileServiceClient = new DaiEncodingProfileServiceClient();

    // Prepare the request message.
    $activateDaiEncodingProfileRequest = (new ActivateDaiEncodingProfileRequest())
        ->setName($formattedRequestsName);
    $requests = [$activateDaiEncodingProfileRequest,];
    $request = (new BatchActivateDaiEncodingProfilesRequest())
        ->setParent($formattedParent)
        ->setRequests($requests);

    // Call the API and handle any network failures.
    try {
        /** @var BatchActivateDaiEncodingProfilesResponse $response */
        $response = $daiEncodingProfileServiceClient->batchActivateDaiEncodingProfiles($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 = DaiEncodingProfileServiceClient::networkName('[NETWORK_CODE]');
    $formattedRequestsName = DaiEncodingProfileServiceClient::daiEncodingProfileName(
        '[NETWORK_CODE]',
        '[DAI_ENCODING_PROFILE]'
    );

    batch_activate_dai_encoding_profiles_sample($formattedParent, $formattedRequestsName);
}

batchArchiveDaiEncodingProfiles

Archives a list of DaiEncodingProfile objects.

The async variant is DaiEncodingProfileServiceClient::batchArchiveDaiEncodingProfilesAsync() .

Parameters
Name Description
request Google\Ads\AdManager\V1\BatchArchiveDaiEncodingProfilesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Ads\AdManager\V1\BatchArchiveDaiEncodingProfilesResponse
Example
use Google\Ads\AdManager\V1\ArchiveDaiEncodingProfileRequest;
use Google\Ads\AdManager\V1\BatchArchiveDaiEncodingProfilesRequest;
use Google\Ads\AdManager\V1\BatchArchiveDaiEncodingProfilesResponse;
use Google\Ads\AdManager\V1\Client\DaiEncodingProfileServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       Format: `networks/{network_code}`
 *                                      Please see {@see DaiEncodingProfileServiceClient::networkName()} for help formatting this field.
 * @param string $formattedRequestsName The resource name of the DaiEncodingProfile to archive.
 *                                      Format:
 *                                      `networks/{network_code}/daiEncodingProfiles/{dai_encoding_profile_id}`
 *                                      Please see {@see DaiEncodingProfileServiceClient::daiEncodingProfileName()} for help formatting this field.
 */
function batch_archive_dai_encoding_profiles_sample(
    string $formattedParent,
    string $formattedRequestsName
): void {
    // Create a client.
    $daiEncodingProfileServiceClient = new DaiEncodingProfileServiceClient();

    // Prepare the request message.
    $archiveDaiEncodingProfileRequest = (new ArchiveDaiEncodingProfileRequest())
        ->setName($formattedRequestsName);
    $requests = [$archiveDaiEncodingProfileRequest,];
    $request = (new BatchArchiveDaiEncodingProfilesRequest())
        ->setParent($formattedParent)
        ->setRequests($requests);

    // Call the API and handle any network failures.
    try {
        /** @var BatchArchiveDaiEncodingProfilesResponse $response */
        $response = $daiEncodingProfileServiceClient->batchArchiveDaiEncodingProfiles($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 = DaiEncodingProfileServiceClient::networkName('[NETWORK_CODE]');
    $formattedRequestsName = DaiEncodingProfileServiceClient::daiEncodingProfileName(
        '[NETWORK_CODE]',
        '[DAI_ENCODING_PROFILE]'
    );

    batch_archive_dai_encoding_profiles_sample($formattedParent, $formattedRequestsName);
}

batchCreateDaiEncodingProfiles

Batch creates DaiEncodingProfile objects.

The async variant is DaiEncodingProfileServiceClient::batchCreateDaiEncodingProfilesAsync() .

Parameters
Name Description
request Google\Ads\AdManager\V1\BatchCreateDaiEncodingProfilesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Ads\AdManager\V1\BatchCreateDaiEncodingProfilesResponse
Example
use Google\Ads\AdManager\V1\BatchCreateDaiEncodingProfilesRequest;
use Google\Ads\AdManager\V1\BatchCreateDaiEncodingProfilesResponse;
use Google\Ads\AdManager\V1\Client\DaiEncodingProfileServiceClient;
use Google\Ads\AdManager\V1\ContainerTypeEnum\ContainerType;
use Google\Ads\AdManager\V1\CreateDaiEncodingProfileRequest;
use Google\Ads\AdManager\V1\DaiEncodingProfile;
use Google\Ads\AdManager\V1\DaiEncodingProfileVariantTypeEnum\DaiEncodingProfileVariantType;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent                         The parent resource where `DaiEncodingProfiles` will be created.
 *                                                        Format: `networks/{network_code}`
 *                                                        The parent field in the CreateDaiEncodingProfileRequest must match this
 *                                                        field. Please see
 *                                                        {@see DaiEncodingProfileServiceClient::networkName()} for help formatting this field.
 * @param string $formattedRequestsParent                 The parent resource where this `DaiEncodingProfile` will be
 *                                                        created. Format: `networks/{network_code}`
 *                                                        Please see {@see DaiEncodingProfileServiceClient::networkName()} for help formatting this field.
 * @param string $requestsDaiEncodingProfileDisplayName   The name of the DaiEncodingProfile. It may be at most 64
 *                                                        characters. The name field can contain alphanumeric characters and symbols
 *                                                        other than the following: ", ', =, !, +, #, , ~, ;, ^, (, ), <, >, [, ],
 *                                                        the white space character.
 * @param int    $requestsDaiEncodingProfileVariantType   The variant playlist type that this DaiEncodingProfile
 *                                                        represents.
 * @param int    $requestsDaiEncodingProfileContainerType The digital container type of the underlying media. This is
 *                                                        required for MEDIA and IFRAME variant types.
 */
function batch_create_dai_encoding_profiles_sample(
    string $formattedParent,
    string $formattedRequestsParent,
    string $requestsDaiEncodingProfileDisplayName,
    int $requestsDaiEncodingProfileVariantType,
    int $requestsDaiEncodingProfileContainerType
): void {
    // Create a client.
    $daiEncodingProfileServiceClient = new DaiEncodingProfileServiceClient();

    // Prepare the request message.
    $requestsDaiEncodingProfile = (new DaiEncodingProfile())
        ->setDisplayName($requestsDaiEncodingProfileDisplayName)
        ->setVariantType($requestsDaiEncodingProfileVariantType)
        ->setContainerType($requestsDaiEncodingProfileContainerType);
    $createDaiEncodingProfileRequest = (new CreateDaiEncodingProfileRequest())
        ->setParent($formattedRequestsParent)
        ->setDaiEncodingProfile($requestsDaiEncodingProfile);
    $requests = [$createDaiEncodingProfileRequest,];
    $request = (new BatchCreateDaiEncodingProfilesRequest())
        ->setParent($formattedParent)
        ->setRequests($requests);

    // Call the API and handle any network failures.
    try {
        /** @var BatchCreateDaiEncodingProfilesResponse $response */
        $response = $daiEncodingProfileServiceClient->batchCreateDaiEncodingProfiles($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 = DaiEncodingProfileServiceClient::networkName('[NETWORK_CODE]');
    $formattedRequestsParent = DaiEncodingProfileServiceClient::networkName('[NETWORK_CODE]');
    $requestsDaiEncodingProfileDisplayName = '[DISPLAY_NAME]';
    $requestsDaiEncodingProfileVariantType = DaiEncodingProfileVariantType::DAI_ENCODING_PROFILE_VARIANT_TYPE_UNSPECIFIED;
    $requestsDaiEncodingProfileContainerType = ContainerType::CONTAINER_TYPE_UNSPECIFIED;

    batch_create_dai_encoding_profiles_sample(
        $formattedParent,
        $formattedRequestsParent,
        $requestsDaiEncodingProfileDisplayName,
        $requestsDaiEncodingProfileVariantType,
        $requestsDaiEncodingProfileContainerType
    );
}

batchUpdateDaiEncodingProfiles

Batch updates DaiEncodingProfile objects.

The async variant is DaiEncodingProfileServiceClient::batchUpdateDaiEncodingProfilesAsync() .

Parameters
Name Description
request Google\Ads\AdManager\V1\BatchUpdateDaiEncodingProfilesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Ads\AdManager\V1\BatchUpdateDaiEncodingProfilesResponse
Example
use Google\Ads\AdManager\V1\BatchUpdateDaiEncodingProfilesRequest;
use Google\Ads\AdManager\V1\BatchUpdateDaiEncodingProfilesResponse;
use Google\Ads\AdManager\V1\Client\DaiEncodingProfileServiceClient;
use Google\Ads\AdManager\V1\ContainerTypeEnum\ContainerType;
use Google\Ads\AdManager\V1\DaiEncodingProfile;
use Google\Ads\AdManager\V1\DaiEncodingProfileVariantTypeEnum\DaiEncodingProfileVariantType;
use Google\Ads\AdManager\V1\UpdateDaiEncodingProfileRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent                         The parent resource where `DaiEncodingProfiles` will be updated.
 *                                                        Format: `networks/{network_code}`
 *                                                        The parent field in the UpdateDaiEncodingProfileRequest must match this
 *                                                        field. Please see
 *                                                        {@see DaiEncodingProfileServiceClient::networkName()} for help formatting this field.
 * @param string $requestsDaiEncodingProfileDisplayName   The name of the DaiEncodingProfile. It may be at most 64
 *                                                        characters. The name field can contain alphanumeric characters and symbols
 *                                                        other than the following: ", ', =, !, +, #, , ~, ;, ^, (, ), <, >, [, ],
 *                                                        the white space character.
 * @param int    $requestsDaiEncodingProfileVariantType   The variant playlist type that this DaiEncodingProfile
 *                                                        represents.
 * @param int    $requestsDaiEncodingProfileContainerType The digital container type of the underlying media. This is
 *                                                        required for MEDIA and IFRAME variant types.
 */
function batch_update_dai_encoding_profiles_sample(
    string $formattedParent,
    string $requestsDaiEncodingProfileDisplayName,
    int $requestsDaiEncodingProfileVariantType,
    int $requestsDaiEncodingProfileContainerType
): void {
    // Create a client.
    $daiEncodingProfileServiceClient = new DaiEncodingProfileServiceClient();

    // Prepare the request message.
    $requestsDaiEncodingProfile = (new DaiEncodingProfile())
        ->setDisplayName($requestsDaiEncodingProfileDisplayName)
        ->setVariantType($requestsDaiEncodingProfileVariantType)
        ->setContainerType($requestsDaiEncodingProfileContainerType);
    $updateDaiEncodingProfileRequest = (new UpdateDaiEncodingProfileRequest())
        ->setDaiEncodingProfile($requestsDaiEncodingProfile);
    $requests = [$updateDaiEncodingProfileRequest,];
    $request = (new BatchUpdateDaiEncodingProfilesRequest())
        ->setParent($formattedParent)
        ->setRequests($requests);

    // Call the API and handle any network failures.
    try {
        /** @var BatchUpdateDaiEncodingProfilesResponse $response */
        $response = $daiEncodingProfileServiceClient->batchUpdateDaiEncodingProfiles($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 = DaiEncodingProfileServiceClient::networkName('[NETWORK_CODE]');
    $requestsDaiEncodingProfileDisplayName = '[DISPLAY_NAME]';
    $requestsDaiEncodingProfileVariantType = DaiEncodingProfileVariantType::DAI_ENCODING_PROFILE_VARIANT_TYPE_UNSPECIFIED;
    $requestsDaiEncodingProfileContainerType = ContainerType::CONTAINER_TYPE_UNSPECIFIED;

    batch_update_dai_encoding_profiles_sample(
        $formattedParent,
        $requestsDaiEncodingProfileDisplayName,
        $requestsDaiEncodingProfileVariantType,
        $requestsDaiEncodingProfileContainerType
    );
}

createDaiEncodingProfile

Creates a DaiEncodingProfile object.

The async variant is DaiEncodingProfileServiceClient::createDaiEncodingProfileAsync() .

Parameters
Name Description
request Google\Ads\AdManager\V1\CreateDaiEncodingProfileRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Ads\AdManager\V1\DaiEncodingProfile
Example
use Google\Ads\AdManager\V1\Client\DaiEncodingProfileServiceClient;
use Google\Ads\AdManager\V1\ContainerTypeEnum\ContainerType;
use Google\Ads\AdManager\V1\CreateDaiEncodingProfileRequest;
use Google\Ads\AdManager\V1\DaiEncodingProfile;
use Google\Ads\AdManager\V1\DaiEncodingProfileVariantTypeEnum\DaiEncodingProfileVariantType;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent                 The parent resource where this `DaiEncodingProfile` will be
 *                                                created. Format: `networks/{network_code}`
 *                                                Please see {@see DaiEncodingProfileServiceClient::networkName()} for help formatting this field.
 * @param string $daiEncodingProfileDisplayName   The name of the DaiEncodingProfile. It may be at most 64
 *                                                characters. The name field can contain alphanumeric characters and symbols
 *                                                other than the following: ", ', =, !, +, #, , ~, ;, ^, (, ), <, >, [, ],
 *                                                the white space character.
 * @param int    $daiEncodingProfileVariantType   The variant playlist type that this DaiEncodingProfile
 *                                                represents.
 * @param int    $daiEncodingProfileContainerType The digital container type of the underlying media. This is
 *                                                required for MEDIA and IFRAME variant types.
 */
function create_dai_encoding_profile_sample(
    string $formattedParent,
    string $daiEncodingProfileDisplayName,
    int $daiEncodingProfileVariantType,
    int $daiEncodingProfileContainerType
): void {
    // Create a client.
    $daiEncodingProfileServiceClient = new DaiEncodingProfileServiceClient();

    // Prepare the request message.
    $daiEncodingProfile = (new DaiEncodingProfile())
        ->setDisplayName($daiEncodingProfileDisplayName)
        ->setVariantType($daiEncodingProfileVariantType)
        ->setContainerType($daiEncodingProfileContainerType);
    $request = (new CreateDaiEncodingProfileRequest())
        ->setParent($formattedParent)
        ->setDaiEncodingProfile($daiEncodingProfile);

    // Call the API and handle any network failures.
    try {
        /** @var DaiEncodingProfile $response */
        $response = $daiEncodingProfileServiceClient->createDaiEncodingProfile($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 = DaiEncodingProfileServiceClient::networkName('[NETWORK_CODE]');
    $daiEncodingProfileDisplayName = '[DISPLAY_NAME]';
    $daiEncodingProfileVariantType = DaiEncodingProfileVariantType::DAI_ENCODING_PROFILE_VARIANT_TYPE_UNSPECIFIED;
    $daiEncodingProfileContainerType = ContainerType::CONTAINER_TYPE_UNSPECIFIED;

    create_dai_encoding_profile_sample(
        $formattedParent,
        $daiEncodingProfileDisplayName,
        $daiEncodingProfileVariantType,
        $daiEncodingProfileContainerType
    );
}

getDaiEncodingProfile

Retrieves a DaiEncodingProfile object.

The async variant is DaiEncodingProfileServiceClient::getDaiEncodingProfileAsync() .

Parameters
Name Description
request Google\Ads\AdManager\V1\GetDaiEncodingProfileRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Ads\AdManager\V1\DaiEncodingProfile
Example
use Google\Ads\AdManager\V1\Client\DaiEncodingProfileServiceClient;
use Google\Ads\AdManager\V1\DaiEncodingProfile;
use Google\Ads\AdManager\V1\GetDaiEncodingProfileRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The resource name of the DaiEncodingProfile.
 *                              Format:
 *                              `networks/{network_code}/daiEncodingProfiles/{dai_encoding_profile_id}`
 *                              Please see {@see DaiEncodingProfileServiceClient::daiEncodingProfileName()} for help formatting this field.
 */
function get_dai_encoding_profile_sample(string $formattedName): void
{
    // Create a client.
    $daiEncodingProfileServiceClient = new DaiEncodingProfileServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var DaiEncodingProfile $response */
        $response = $daiEncodingProfileServiceClient->getDaiEncodingProfile($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 = DaiEncodingProfileServiceClient::daiEncodingProfileName(
        '[NETWORK_CODE]',
        '[DAI_ENCODING_PROFILE]'
    );

    get_dai_encoding_profile_sample($formattedName);
}

listDaiEncodingProfiles

Lists DaiEncodingProfile objects.

The async variant is DaiEncodingProfileServiceClient::listDaiEncodingProfilesAsync() .

Parameters
Name Description
request Google\Ads\AdManager\V1\ListDaiEncodingProfilesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Ads\AdManager\V1\Client\DaiEncodingProfileServiceClient;
use Google\Ads\AdManager\V1\ListDaiEncodingProfilesRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent The parent, which owns this collection of DaiEncodingProfiles.
 *                                Format: `networks/{network_code}`
 *                                Please see {@see DaiEncodingProfileServiceClient::networkName()} for help formatting this field.
 */
function list_dai_encoding_profiles_sample(string $formattedParent): void
{
    // Create a client.
    $daiEncodingProfileServiceClient = new DaiEncodingProfileServiceClient();

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

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

        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 = DaiEncodingProfileServiceClient::networkName('[NETWORK_CODE]');

    list_dai_encoding_profiles_sample($formattedParent);
}

updateDaiEncodingProfile

Updates a DaiEncodingProfile object.

The async variant is DaiEncodingProfileServiceClient::updateDaiEncodingProfileAsync() .

Parameters
Name Description
request Google\Ads\AdManager\V1\UpdateDaiEncodingProfileRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Ads\AdManager\V1\DaiEncodingProfile
Example
use Google\Ads\AdManager\V1\Client\DaiEncodingProfileServiceClient;
use Google\Ads\AdManager\V1\ContainerTypeEnum\ContainerType;
use Google\Ads\AdManager\V1\DaiEncodingProfile;
use Google\Ads\AdManager\V1\DaiEncodingProfileVariantTypeEnum\DaiEncodingProfileVariantType;
use Google\Ads\AdManager\V1\UpdateDaiEncodingProfileRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $daiEncodingProfileDisplayName   The name of the DaiEncodingProfile. It may be at most 64
 *                                                characters. The name field can contain alphanumeric characters and symbols
 *                                                other than the following: ", ', =, !, +, #, , ~, ;, ^, (, ), <, >, [, ],
 *                                                the white space character.
 * @param int    $daiEncodingProfileVariantType   The variant playlist type that this DaiEncodingProfile
 *                                                represents.
 * @param int    $daiEncodingProfileContainerType The digital container type of the underlying media. This is
 *                                                required for MEDIA and IFRAME variant types.
 */
function update_dai_encoding_profile_sample(
    string $daiEncodingProfileDisplayName,
    int $daiEncodingProfileVariantType,
    int $daiEncodingProfileContainerType
): void {
    // Create a client.
    $daiEncodingProfileServiceClient = new DaiEncodingProfileServiceClient();

    // Prepare the request message.
    $daiEncodingProfile = (new DaiEncodingProfile())
        ->setDisplayName($daiEncodingProfileDisplayName)
        ->setVariantType($daiEncodingProfileVariantType)
        ->setContainerType($daiEncodingProfileContainerType);
    $request = (new UpdateDaiEncodingProfileRequest())
        ->setDaiEncodingProfile($daiEncodingProfile);

    // Call the API and handle any network failures.
    try {
        /** @var DaiEncodingProfile $response */
        $response = $daiEncodingProfileServiceClient->updateDaiEncodingProfile($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
{
    $daiEncodingProfileDisplayName = '[DISPLAY_NAME]';
    $daiEncodingProfileVariantType = DaiEncodingProfileVariantType::DAI_ENCODING_PROFILE_VARIANT_TYPE_UNSPECIFIED;
    $daiEncodingProfileContainerType = ContainerType::CONTAINER_TYPE_UNSPECIFIED;

    update_dai_encoding_profile_sample(
        $daiEncodingProfileDisplayName,
        $daiEncodingProfileVariantType,
        $daiEncodingProfileContainerType
    );
}

batchActivateDaiEncodingProfilesAsync

Parameters
Name Description
request Google\Ads\AdManager\V1\BatchActivateDaiEncodingProfilesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchActivateDaiEncodingProfilesResponse>

batchArchiveDaiEncodingProfilesAsync

Parameters
Name Description
request Google\Ads\AdManager\V1\BatchArchiveDaiEncodingProfilesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchArchiveDaiEncodingProfilesResponse>

batchCreateDaiEncodingProfilesAsync

Parameters
Name Description
request Google\Ads\AdManager\V1\BatchCreateDaiEncodingProfilesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchCreateDaiEncodingProfilesResponse>

batchUpdateDaiEncodingProfilesAsync

Parameters
Name Description
request Google\Ads\AdManager\V1\BatchUpdateDaiEncodingProfilesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchUpdateDaiEncodingProfilesResponse>

createDaiEncodingProfileAsync

Parameters
Name Description
request Google\Ads\AdManager\V1\CreateDaiEncodingProfileRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\DaiEncodingProfile>

getDaiEncodingProfileAsync

Parameters
Name Description
request Google\Ads\AdManager\V1\GetDaiEncodingProfileRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\DaiEncodingProfile>

listDaiEncodingProfilesAsync

Parameters
Name Description
request Google\Ads\AdManager\V1\ListDaiEncodingProfilesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

updateDaiEncodingProfileAsync

Parameters
Name Description
request Google\Ads\AdManager\V1\UpdateDaiEncodingProfileRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\DaiEncodingProfile>

static::daiEncodingProfileName

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

Parameters
Name Description
networkCode string
daiEncodingProfile string
Returns
Type Description
string The formatted dai_encoding_profile resource.

static::networkName

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

Parameter
Name Description
networkCode string
Returns
Type Description
string The formatted network 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

  • daiEncodingProfile: networks/{network_code}/daiEncodingProfiles/{dai_encoding_profile}
  • network: networks/{network_code}

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.