0.16.0 (latest) 0.15.1 0.14.1 0.8.0 0.7.0 0.6.2 0.5.0 0.4.1 0.3.1 0.2.0 0.1.3 Reference documentation and code samples for the Google Ads Ad Manager V1 Client class SiteServiceClient.

Service Description: Provides methods for handling `Site` 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|https://docs.cloud.google.com/php/docs/reference/gax/latest/Options.ClientOptions.html` 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` | `https://docs.cloud.google.com/php/docs/reference/auth/latest/FetchAuthTokenInterface.html|https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper.html` This option should only be used with a pre-constructed [Google\\Auth\\FetchAuthTokenInterface](https://docs.cloud.google.com/php/docs/reference/auth/latest/FetchAuthTokenInterface.html) or [Google\\ApiCore\\CredentialsWrapper](https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper.html) 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\SiteServiceClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new SiteServiceClient(['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()](https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper.html#_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|https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.TransportInterface.html` 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](https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.TransportInterface.html) 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()](https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.RestTransport.html#_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'. |

### batchCreateSites

Creates `Site` objects.

The async variant is [SiteServiceClient::batchCreateSitesAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.SiteServiceClient#_Google_Ads_AdManager_V1_Client_SiteServiceClient__batchCreateSitesAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.BatchCreateSitesRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.BatchCreateSitesResponse` |   |

**Example**

    use Google\Ads\AdManager\V1\BatchCreateSitesRequest;
    use Google\Ads\AdManager\V1\BatchCreateSitesResponse;
    use Google\Ads\AdManager\V1\Client\SiteServiceClient;
    use Google\Ads\AdManager\V1\CreateSiteRequest;
    use Google\Ads\AdManager\V1\Site;
    use Google\ApiCore\ApiException;

    /**
     * @param string $formattedParent         The parent resource where `Sites` will be created.
     *                                        Format: `networks/{network_code}`
     *                                        The parent field in the CreateSiteRequest must match this
     *                                        field. Please see
     *                                        {@see SiteServiceClient::networkName()} for help formatting this field.
     * @param string $formattedRequestsParent The parent resource where this `Site` will be created.
     *                                        Format: `networks/{network_code}`
     *                                        Please see {@see SiteServiceClient::networkName()} for help formatting this field.
     * @param string $requestsSiteUrl         The URL of the Site.
     */
    function batch_create_sites_sample(
        string $formattedParent,
        string $formattedRequestsParent,
        string $requestsSiteUrl
    ): void {
        // Create a client.
        $siteServiceClient = new SiteServiceClient();

        // Prepare the request message.
        $requestsSite = (new Site())
            ->setUrl($requestsSiteUrl);
        $createSiteRequest = (new CreateSiteRequest())
            ->setParent($formattedRequestsParent)
            ->setSite($requestsSite);
        $requests = [$createSiteRequest];
        $request = (new BatchCreateSitesRequest())
            ->setParent($formattedParent)
            ->setRequests($requests);

        // Call the API and handle any network failures.
        try {
            /** @var BatchCreateSitesResponse $response */
            $response = $siteServiceClient->batchCreateSites($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 = SiteServiceClient::networkName('[NETWORK_CODE]');
        $formattedRequestsParent = SiteServiceClient::networkName('[NETWORK_CODE]');
        $requestsSiteUrl = '[URL]';

        batch_create_sites_sample($formattedParent, $formattedRequestsParent, $requestsSiteUrl);
    }

### batchDeactivateSites

Deactivates a list of `Site` objects.

The async variant is [SiteServiceClient::batchDeactivateSitesAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.SiteServiceClient#_Google_Ads_AdManager_V1_Client_SiteServiceClient__batchDeactivateSitesAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.BatchDeactivateSitesRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.BatchDeactivateSitesResponse` |   |

**Example**

    use Google\Ads\AdManager\V1\BatchDeactivateSitesRequest;
    use Google\Ads\AdManager\V1\BatchDeactivateSitesResponse;
    use Google\Ads\AdManager\V1\Client\SiteServiceClient;
    use Google\ApiCore\ApiException;

    /**
     * @param string $formattedParent Format: `networks/{network_code}`
     *                                Please see {@see SiteServiceClient::networkName()} for help formatting this field.
     * @param string $namesElement    The resource names of the `Site` objects to deactivate.
     */
    function batch_deactivate_sites_sample(string $formattedParent, string $namesElement): void
    {
        // Create a client.
        $siteServiceClient = new SiteServiceClient();

        // Prepare the request message.
        $names = [$namesElement];
        $request = (new BatchDeactivateSitesRequest())
            ->setParent($formattedParent)
            ->setNames($names);

        // Call the API and handle any network failures.
        try {
            /** @var BatchDeactivateSitesResponse $response */
            $response = $siteServiceClient->batchDeactivateSites($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 = SiteServiceClient::networkName('[NETWORK_CODE]');
        $namesElement = '[NAMES]';

        batch_deactivate_sites_sample($formattedParent, $namesElement);
    }

### batchSubmitSitesForApproval

Submits a list of `Site` objects for approval.

The async variant is
[SiteServiceClient::batchSubmitSitesForApprovalAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.SiteServiceClient#_Google_Ads_AdManager_V1_Client_SiteServiceClient__batchSubmitSitesForApprovalAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.BatchSubmitSitesForApprovalRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.BatchSubmitSitesForApprovalResponse` |   |

**Example**

    use Google\Ads\AdManager\V1\BatchSubmitSitesForApprovalRequest;
    use Google\Ads\AdManager\V1\BatchSubmitSitesForApprovalResponse;
    use Google\Ads\AdManager\V1\Client\SiteServiceClient;
    use Google\ApiCore\ApiException;

    /**
     * @param string $formattedParent Format: `networks/{network_code}`
     *                                Please see {@see SiteServiceClient::networkName()} for help formatting this field.
     * @param string $namesElement    The resource names of the `Site` objects to submit for approval.
     */
    function batch_submit_sites_for_approval_sample(
        string $formattedParent,
        string $namesElement
    ): void {
        // Create a client.
        $siteServiceClient = new SiteServiceClient();

        // Prepare the request message.
        $names = [$namesElement];
        $request = (new BatchSubmitSitesForApprovalRequest())
            ->setParent($formattedParent)
            ->setNames($names);

        // Call the API and handle any network failures.
        try {
            /** @var BatchSubmitSitesForApprovalResponse $response */
            $response = $siteServiceClient->batchSubmitSitesForApproval($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 = SiteServiceClient::networkName('[NETWORK_CODE]');
        $namesElement = '[NAMES]';

        batch_submit_sites_for_approval_sample($formattedParent, $namesElement);
    }

### batchUpdateSites

Batch updates `Site` objects.

The async variant is [SiteServiceClient::batchUpdateSitesAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.SiteServiceClient#_Google_Ads_AdManager_V1_Client_SiteServiceClient__batchUpdateSitesAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.BatchUpdateSitesRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.BatchUpdateSitesResponse` |   |

**Example**

    use Google\Ads\AdManager\V1\BatchUpdateSitesRequest;
    use Google\Ads\AdManager\V1\BatchUpdateSitesResponse;
    use Google\Ads\AdManager\V1\Client\SiteServiceClient;
    use Google\Ads\AdManager\V1\Site;
    use Google\Ads\AdManager\V1\UpdateSiteRequest;
    use Google\ApiCore\ApiException;

    /**
     * @param string $formattedParent The parent resource where `Sites` will be updated.
     *                                Format: `networks/{network_code}`
     *                                The parent field in the UpdateSiteRequest must match this
     *                                field. Please see
     *                                {@see SiteServiceClient::networkName()} for help formatting this field.
     * @param string $requestsSiteUrl The URL of the Site.
     */
    function batch_update_sites_sample(string $formattedParent, string $requestsSiteUrl): void
    {
        // Create a client.
        $siteServiceClient = new SiteServiceClient();

        // Prepare the request message.
        $requestsSite = (new Site())
            ->setUrl($requestsSiteUrl);
        $updateSiteRequest = (new UpdateSiteRequest())
            ->setSite($requestsSite);
        $requests = [$updateSiteRequest];
        $request = (new BatchUpdateSitesRequest())
            ->setParent($formattedParent)
            ->setRequests($requests);

        // Call the API and handle any network failures.
        try {
            /** @var BatchUpdateSitesResponse $response */
            $response = $siteServiceClient->batchUpdateSites($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 = SiteServiceClient::networkName('[NETWORK_CODE]');
        $requestsSiteUrl = '[URL]';

        batch_update_sites_sample($formattedParent, $requestsSiteUrl);
    }

### createSite

Creates a `Site` object.

The async variant is [SiteServiceClient::createSiteAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.SiteServiceClient#_Google_Ads_AdManager_V1_Client_SiteServiceClient__createSiteAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.CreateSiteRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Site` |   |

**Example**

    use Google\Ads\AdManager\V1\Client\SiteServiceClient;
    use Google\Ads\AdManager\V1\CreateSiteRequest;
    use Google\Ads\AdManager\V1\Site;
    use Google\ApiCore\ApiException;

    /**
     * @param string $formattedParent The parent resource where this `Site` will be created.
     *                                Format: `networks/{network_code}`
     *                                Please see {@see SiteServiceClient::networkName()} for help formatting this field.
     * @param string $siteUrl         The URL of the Site.
     */
    function create_site_sample(string $formattedParent, string $siteUrl): void
    {
        // Create a client.
        $siteServiceClient = new SiteServiceClient();

        // Prepare the request message.
        $site = (new Site())
            ->setUrl($siteUrl);
        $request = (new CreateSiteRequest())
            ->setParent($formattedParent)
            ->setSite($site);

        // Call the API and handle any network failures.
        try {
            /** @var Site $response */
            $response = $siteServiceClient->createSite($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 = SiteServiceClient::networkName('[NETWORK_CODE]');
        $siteUrl = '[URL]';

        create_site_sample($formattedParent, $siteUrl);
    }

### getSite

Retrieves a `Site` object.

The async variant is [SiteServiceClient::getSiteAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.SiteServiceClient#_Google_Ads_AdManager_V1_Client_SiteServiceClient__getSiteAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.GetSiteRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Site` |   |

**Example**

    use Google\Ads\AdManager\V1\Client\SiteServiceClient;
    use Google\Ads\AdManager\V1\GetSiteRequest;
    use Google\Ads\AdManager\V1\Site;
    use Google\ApiCore\ApiException;

    /**
     * @param string $formattedName The resource name of the Site.
     *                              Format: `networks/{network_code}/sites/{site_id}`
     *                              Please see {@see SiteServiceClient::siteName()} for help formatting this field.
     */
    function get_site_sample(string $formattedName): void
    {
        // Create a client.
        $siteServiceClient = new SiteServiceClient();

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

        // Call the API and handle any network failures.
        try {
            /** @var Site $response */
            $response = $siteServiceClient->getSite($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 = SiteServiceClient::siteName('[NETWORK_CODE]', '[SITE]');

        get_site_sample($formattedName);
    }

### listSites

Lists `Site` objects.

The async variant is [SiteServiceClient::listSitesAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.SiteServiceClient#_Google_Ads_AdManager_V1_Client_SiteServiceClient__listSitesAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.ListSitesRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html` |   |

**Example**

    use Google\Ads\AdManager\V1\Client\SiteServiceClient;
    use Google\Ads\AdManager\V1\ListSitesRequest;
    use Google\ApiCore\ApiException;
    use Google\ApiCore\PagedListResponse;

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

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

        // Call the API and handle any network failures.
        try {
            /** @var PagedListResponse $response */
            $response = $siteServiceClient->listSites($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 = SiteServiceClient::networkName('[NETWORK_CODE]');

        list_sites_sample($formattedParent);
    }

### updateSite

Updates a `Site` object.

The async variant is [SiteServiceClient::updateSiteAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.SiteServiceClient#_Google_Ads_AdManager_V1_Client_SiteServiceClient__updateSiteAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.UpdateSiteRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Site` |   |

**Example**

    use Google\Ads\AdManager\V1\Client\SiteServiceClient;
    use Google\Ads\AdManager\V1\Site;
    use Google\Ads\AdManager\V1\UpdateSiteRequest;
    use Google\ApiCore\ApiException;

    /**
     * @param string $siteUrl The URL of the Site.
     */
    function update_site_sample(string $siteUrl): void
    {
        // Create a client.
        $siteServiceClient = new SiteServiceClient();

        // Prepare the request message.
        $site = (new Site())
            ->setUrl($siteUrl);
        $request = (new UpdateSiteRequest())
            ->setSite($site);

        // Call the API and handle any network failures.
        try {
            /** @var Site $response */
            $response = $siteServiceClient->updateSite($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
    {
        $siteUrl = '[URL]';

        update_site_sample($siteUrl);
    }

### batchCreateSitesAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.BatchCreateSitesRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.BatchCreateSitesResponse>` |   |

### batchDeactivateSitesAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.BatchDeactivateSitesRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.BatchDeactivateSitesResponse>` |   |

### batchSubmitSitesForApprovalAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.BatchSubmitSitesForApprovalRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.BatchSubmitSitesForApprovalResponse>` |   |

### batchUpdateSitesAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.BatchUpdateSitesRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.BatchUpdateSitesResponse>` |   |

### createSiteAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.CreateSiteRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Site>` |   |

### getSiteAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.GetSiteRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Site>` |   |

### listSitesAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.ListSitesRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html>` |   |

### updateSiteAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.UpdateSiteRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Site>` |   |

### 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::siteName

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

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `networkCode` | `string` |
| `site` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted site 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

- network: networks/{network_code}
- site: networks/{network_code}/sites/{site}

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