Google Ads Ad Manager V1 Client - Class AdReviewCenterAdServiceClient (0.5.0)

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

Service Description: Provides methods for handling AdReviewCenterAd 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 FetchAuthTokenInterface|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\AdReviewCenterAdServiceClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new AdReviewCenterAdServiceClient(['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|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|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'.

batchAllowAdReviewCenterAds

API to batch allow AdReviewCenterAds.

This method supports partial success. Some operations may succeed while others fail. Callers should check the failedRequests field in the response to determine which operations failed.

The async variant is AdReviewCenterAdServiceClient::batchAllowAdReviewCenterAdsAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse<Google\Ads\AdManager\V1\BatchAllowAdReviewCenterAdsResponse>
Example
use Google\Ads\AdManager\V1\BatchAllowAdReviewCenterAdsRequest;
use Google\Ads\AdManager\V1\BatchAllowAdReviewCenterAdsResponse;
use Google\Ads\AdManager\V1\Client\AdReviewCenterAdServiceClient;
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedParent       The parent, which owns this collection of AdReviewCenterAds.
 *                                      Format: networks/{network_code}/webProperties/{web_property_code}
 *
 *                                      Since a network can only have a single web property of each
 *                                      `ExchangeSyndicationProduct`, you can use the
 *                                      `ExchangeSyndicationProduct` as an alias for the web property code:
 *
 *                                      `networks/{network_code}/webProperties/display`
 *
 *                                      `networks/{network_code}/webProperties/videoAndAudio`
 *
 *                                      `networks/{network_code}/webProperties/mobileApp`
 *
 *                                      `networks/{network_code}/webProperties/games`
 *                                      Please see {@see AdReviewCenterAdServiceClient::webPropertyName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the `AdReviewCenterAd`s to allow.
 *                                      Format:
 *                                      `networks/{network_code}/webProperties/{web_property_code}/adReviewCenterAds/{ad_review_center_ad_id}`
 *                                      Please see {@see AdReviewCenterAdServiceClient::adReviewCenterAdName()} for help formatting this field.
 */
function batch_allow_ad_review_center_ads_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $adReviewCenterAdServiceClient = new AdReviewCenterAdServiceClient();

    // Prepare the request message.
    $formattedNames = [$formattedNamesElement,];
    $request = (new BatchAllowAdReviewCenterAdsRequest())
        ->setParent($formattedParent)
        ->setNames($formattedNames);

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

        if ($response->operationSucceeded()) {
            /** @var BatchAllowAdReviewCenterAdsResponse $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 = AdReviewCenterAdServiceClient::webPropertyName(
        '[NETWORK_CODE]',
        '[WEB_PROPERTY]'
    );
    $formattedNamesElement = AdReviewCenterAdServiceClient::adReviewCenterAdName(
        '[NETWORK_CODE]',
        '[WEB_PROPERTY_CODE]',
        '[AD_REVIEW_CENTER_AD]'
    );

    batch_allow_ad_review_center_ads_sample($formattedParent, $formattedNamesElement);
}

batchBlockAdReviewCenterAds

API to batch block AdReviewCenterAds.

This method supports partial success. Some operations may succeed while others fail. Callers should check the failedRequests field in the response to determine which operations failed.

The async variant is AdReviewCenterAdServiceClient::batchBlockAdReviewCenterAdsAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse<Google\Ads\AdManager\V1\BatchBlockAdReviewCenterAdsResponse>
Example
use Google\Ads\AdManager\V1\BatchBlockAdReviewCenterAdsRequest;
use Google\Ads\AdManager\V1\BatchBlockAdReviewCenterAdsResponse;
use Google\Ads\AdManager\V1\Client\AdReviewCenterAdServiceClient;
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedParent       The parent, which owns this collection of AdReviewCenterAds.
 *                                      Format: networks/{network_code}/webProperties/{web_property_code}
 *
 *                                      Since a network can only have a single web property of each
 *                                      `ExchangeSyndicationProduct`, you can use the
 *                                      `ExchangeSyndicationProduct` as an alias for the web property code:
 *
 *                                      `networks/{network_code}/webProperties/display`
 *
 *                                      `networks/{network_code}/webProperties/videoAndAudio`
 *
 *                                      `networks/{network_code}/webProperties/mobileApp`
 *
 *                                      `networks/{network_code}/webProperties/games`
 *                                      Please see {@see AdReviewCenterAdServiceClient::webPropertyName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the `AdReviewCenterAd`s to block.
 *                                      Format:
 *                                      `networks/{network_code}/webProperties/{web_property_code}/adReviewCenterAds/{ad_review_center_ad_id}`
 *                                      Please see {@see AdReviewCenterAdServiceClient::adReviewCenterAdName()} for help formatting this field.
 */
function batch_block_ad_review_center_ads_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $adReviewCenterAdServiceClient = new AdReviewCenterAdServiceClient();

    // Prepare the request message.
    $formattedNames = [$formattedNamesElement,];
    $request = (new BatchBlockAdReviewCenterAdsRequest())
        ->setParent($formattedParent)
        ->setNames($formattedNames);

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

        if ($response->operationSucceeded()) {
            /** @var BatchBlockAdReviewCenterAdsResponse $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 = AdReviewCenterAdServiceClient::webPropertyName(
        '[NETWORK_CODE]',
        '[WEB_PROPERTY]'
    );
    $formattedNamesElement = AdReviewCenterAdServiceClient::adReviewCenterAdName(
        '[NETWORK_CODE]',
        '[WEB_PROPERTY_CODE]',
        '[AD_REVIEW_CENTER_AD]'
    );

    batch_block_ad_review_center_ads_sample($formattedParent, $formattedNamesElement);
}

searchAdReviewCenterAds

API to search for AdReviewCenterAds.

The async variant is AdReviewCenterAdServiceClient::searchAdReviewCenterAdsAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Ads\AdManager\V1\AdReviewCenterAdStatusEnum\AdReviewCenterAdStatus;
use Google\Ads\AdManager\V1\Client\AdReviewCenterAdServiceClient;
use Google\Ads\AdManager\V1\SearchAdReviewCenterAdsRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent The parent, which owns this collection of AdReviewCenterAds.
 *                                Format: networks/{network_code}/webProperties/{web_property_code}
 *
 *                                Since a network can only have a single web property of each
 *                                `ExchangeSyndicationProduct`, you can use the
 *                                `ExchangeSyndicationProduct` as an alias for the web property code:
 *
 *                                `networks/{network_code}/webProperties/display`
 *
 *                                `networks/{network_code}/webProperties/videoAndAudio`
 *
 *                                `networks/{network_code}/webProperties/mobileApp`
 *
 *                                `networks/{network_code}/webProperties/games`
 *                                Please see {@see AdReviewCenterAdServiceClient::webPropertyName()} for help formatting this field.
 * @param int    $status          Only return ads with the given status.
 */
function search_ad_review_center_ads_sample(string $formattedParent, int $status): void
{
    // Create a client.
    $adReviewCenterAdServiceClient = new AdReviewCenterAdServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $adReviewCenterAdServiceClient->searchAdReviewCenterAds($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 = AdReviewCenterAdServiceClient::webPropertyName(
        '[NETWORK_CODE]',
        '[WEB_PROPERTY]'
    );
    $status = AdReviewCenterAdStatus::AD_REVIEW_CENTER_AD_STATUS_UNSPECIFIED;

    search_ad_review_center_ads_sample($formattedParent, $status);
}

batchAllowAdReviewCenterAdsAsync

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

batchBlockAdReviewCenterAdsAsync

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

searchAdReviewCenterAdsAsync

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

getOperationsClient

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

Returns
Type Description
Google\LongRunning\Client\OperationsClient

resumeOperation

Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.

Parameters
Name Description
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
Type Description
Google\ApiCore\OperationResponse

static::adReviewCenterAdName

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

Parameters
Name Description
networkCode string
webPropertyCode string
adReviewCenterAd string
Returns
Type Description
string The formatted ad_review_center_ad resource.

static::webPropertyName

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

Parameters
Name Description
networkCode string
webProperty string
Returns
Type Description
string The formatted web_property 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

  • adReviewCenterAd: networks/{network_code}/webProperties/{web_property_code}/adReviewCenterAds/{ad_review_center_ad}
  • webProperty: networks/{network_code}/webProperties/{web_property}

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.