0.17.0 (latest) 0.16.0 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 PlacementServiceClient.

Service Description: Provides methods for handling `Placement` 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](https://docs.cloud.google.com/php/docs/reference/auth/latest/FetchAuthTokenInterface.md.txt) or [Google\\ApiCore\\CredentialsWrapper](https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper.md.txt) 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\PlacementServiceClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new PlacementServiceClient(['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.md.txt#_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](https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.TransportInterface.md.txt) 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.md.txt#_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'. |

### batchActivatePlacements

Activates a list of `Placement` objects.

The async variant is
[PlacementServiceClient::batchActivatePlacementsAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.PlacementServiceClient.md.txt#_Google_Ads_AdManager_V1_Client_PlacementServiceClient__batchActivatePlacementsAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\BatchActivatePlacementsRequest` 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](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.md.txt) 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.md.txt) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Ads\AdManager\V1\BatchActivatePlacementsResponse` |   |

**Example**

```php
use Google\Ads\AdManager\V1\BatchActivatePlacementsRequest;
use Google\Ads\AdManager\V1\BatchActivatePlacementsResponse;
use Google\Ads\AdManager\V1\Client\PlacementServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       Format: `networks/{network_code}`
 *                                      Please see {@see PlacementServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The names of the `Placement` objects to activate.
 *                                      Format: `networks/{network_code}/placements/{placement_id}`
 *                                      Please see {@see PlacementServiceClient::placementName()} for help formatting this field.
 */
function batch_activate_placements_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $placementServiceClient = new PlacementServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchActivatePlacementsResponse $response */
        $response = $placementServiceClient->batchActivatePlacements($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 = PlacementServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = PlacementServiceClient::placementName('[NETWORK_CODE]', '[PLACEMENT]');

    batch_activate_placements_sample($formattedParent, $formattedNamesElement);
}
```

### batchArchivePlacements

Archives a list of `Placement` objects.

The async variant is
[PlacementServiceClient::batchArchivePlacementsAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.PlacementServiceClient.md.txt#_Google_Ads_AdManager_V1_Client_PlacementServiceClient__batchArchivePlacementsAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\BatchArchivePlacementsRequest` 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](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.md.txt) 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.md.txt) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Ads\AdManager\V1\BatchArchivePlacementsResponse` |   |

**Example**

```php
use Google\Ads\AdManager\V1\BatchArchivePlacementsRequest;
use Google\Ads\AdManager\V1\BatchArchivePlacementsResponse;
use Google\Ads\AdManager\V1\Client\PlacementServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       Format: `networks/{network_code}`
 *                                      Please see {@see PlacementServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The names of the `Placement` objects to archive.
 *                                      Format: `networks/{network_code}/placements/{placement_id}`
 *                                      Please see {@see PlacementServiceClient::placementName()} for help formatting this field.
 */
function batch_archive_placements_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $placementServiceClient = new PlacementServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchArchivePlacementsResponse $response */
        $response = $placementServiceClient->batchArchivePlacements($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 = PlacementServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = PlacementServiceClient::placementName('[NETWORK_CODE]', '[PLACEMENT]');

    batch_archive_placements_sample($formattedParent, $formattedNamesElement);
}
```

### batchCreatePlacements

Creates `Placement` objects.

The async variant is [PlacementServiceClient::batchCreatePlacementsAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.PlacementServiceClient.md.txt#_Google_Ads_AdManager_V1_Client_PlacementServiceClient__batchCreatePlacementsAsync__)
.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\BatchCreatePlacementsRequest` 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](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.md.txt) 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.md.txt) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Ads\AdManager\V1\BatchCreatePlacementsResponse` |   |

**Example**

```php
use Google\Ads\AdManager\V1\BatchCreatePlacementsRequest;
use Google\Ads\AdManager\V1\BatchCreatePlacementsResponse;
use Google\Ads\AdManager\V1\Client\PlacementServiceClient;
use Google\Ads\AdManager\V1\CreatePlacementRequest;
use Google\Ads\AdManager\V1\Placement;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent              The parent resource where the `Placement`s will be created.
 *                                             Format: `networks/{network_code}`
 *                                             The parent field in the CreatePlacementRequest messages match this
 *                                             field. Please see
 *                                             {@see PlacementServiceClient::networkName()} for help formatting this field.
 * @param string $formattedRequestsParent      The parent resource where this `Placement` will be created.
 *                                             Format: `networks/{network_code}`
 *                                             Please see {@see PlacementServiceClient::networkName()} for help formatting this field.
 * @param string $requestsPlacementDisplayName The display name of the placement. This attribute has a maximum
 *                                             length of 255 characters.
 */
function batch_create_placements_sample(
    string $formattedParent,
    string $formattedRequestsParent,
    string $requestsPlacementDisplayName
): void {
    // Create a client.
    $placementServiceClient = new PlacementServiceClient();

    // Prepare the request message.
    $requestsPlacement = (new Placement())
        ->setDisplayName($requestsPlacementDisplayName);
    $createPlacementRequest = (new CreatePlacementRequest())
        ->setParent($formattedRequestsParent)
        ->setPlacement($requestsPlacement);
    $requests = [$createPlacementRequest];
    $request = (new BatchCreatePlacementsRequest())
        ->setParent($formattedParent)
        ->setRequests($requests);

    // Call the API and handle any network failures.
    try {
        /** @var BatchCreatePlacementsResponse $response */
        $response = $placementServiceClient->batchCreatePlacements($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 = PlacementServiceClient::networkName('[NETWORK_CODE]');
    $formattedRequestsParent = PlacementServiceClient::networkName('[NETWORK_CODE]');
    $requestsPlacementDisplayName = '[DISPLAY_NAME]';

    batch_create_placements_sample(
        $formattedParent,
        $formattedRequestsParent,
        $requestsPlacementDisplayName
    );
}
```

### batchDeactivatePlacements

Deactivates a list of `Placement` objects.

The async variant is
[PlacementServiceClient::batchDeactivatePlacementsAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.PlacementServiceClient.md.txt#_Google_Ads_AdManager_V1_Client_PlacementServiceClient__batchDeactivatePlacementsAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\BatchDeactivatePlacementsRequest` 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](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.md.txt) 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.md.txt) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Ads\AdManager\V1\BatchDeactivatePlacementsResponse` |   |

**Example**

```php
use Google\Ads\AdManager\V1\BatchDeactivatePlacementsRequest;
use Google\Ads\AdManager\V1\BatchDeactivatePlacementsResponse;
use Google\Ads\AdManager\V1\Client\PlacementServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       Format: `networks/{network_code}`
 *                                      Please see {@see PlacementServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The names of the `Placement` objects to deactivate.
 *                                      Format: `networks/{network_code}/placements/{placement_id}`
 *                                      Please see {@see PlacementServiceClient::placementName()} for help formatting this field.
 */
function batch_deactivate_placements_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $placementServiceClient = new PlacementServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchDeactivatePlacementsResponse $response */
        $response = $placementServiceClient->batchDeactivatePlacements($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 = PlacementServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = PlacementServiceClient::placementName('[NETWORK_CODE]', '[PLACEMENT]');

    batch_deactivate_placements_sample($formattedParent, $formattedNamesElement);
}
```

### batchUpdatePlacements

Batch updates `Placement` objects.

The async variant is [PlacementServiceClient::batchUpdatePlacementsAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.PlacementServiceClient.md.txt#_Google_Ads_AdManager_V1_Client_PlacementServiceClient__batchUpdatePlacementsAsync__)
.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\BatchUpdatePlacementsRequest` 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](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.md.txt) 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.md.txt) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Ads\AdManager\V1\BatchUpdatePlacementsResponse` |   |

**Example**

```php
use Google\Ads\AdManager\V1\BatchUpdatePlacementsRequest;
use Google\Ads\AdManager\V1\BatchUpdatePlacementsResponse;
use Google\Ads\AdManager\V1\Client\PlacementServiceClient;
use Google\Ads\AdManager\V1\Placement;
use Google\Ads\AdManager\V1\UpdatePlacementRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent              The parent resource where `Placements` will be updated.
 *                                             Format: `networks/{network_code}`
 *                                             The parent field in the UpdatePlacementsRequest must match this
 *                                             field. Please see
 *                                             {@see PlacementServiceClient::networkName()} for help formatting this field.
 * @param string $requestsPlacementDisplayName The display name of the placement. This attribute has a maximum
 *                                             length of 255 characters.
 */
function batch_update_placements_sample(
    string $formattedParent,
    string $requestsPlacementDisplayName
): void {
    // Create a client.
    $placementServiceClient = new PlacementServiceClient();

    // Prepare the request message.
    $requestsPlacement = (new Placement())
        ->setDisplayName($requestsPlacementDisplayName);
    $updatePlacementRequest = (new UpdatePlacementRequest())
        ->setPlacement($requestsPlacement);
    $requests = [$updatePlacementRequest];
    $request = (new BatchUpdatePlacementsRequest())
        ->setParent($formattedParent)
        ->setRequests($requests);

    // Call the API and handle any network failures.
    try {
        /** @var BatchUpdatePlacementsResponse $response */
        $response = $placementServiceClient->batchUpdatePlacements($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 = PlacementServiceClient::networkName('[NETWORK_CODE]');
    $requestsPlacementDisplayName = '[DISPLAY_NAME]';

    batch_update_placements_sample($formattedParent, $requestsPlacementDisplayName);
}
```

### createPlacement

Creates an `Placement` object.

The async variant is [PlacementServiceClient::createPlacementAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.PlacementServiceClient.md.txt#_Google_Ads_AdManager_V1_Client_PlacementServiceClient__createPlacementAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\CreatePlacementRequest` 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](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.md.txt) 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.md.txt) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Ads\AdManager\V1\Placement` |   |

**Example**

```php
use Google\Ads\AdManager\V1\Client\PlacementServiceClient;
use Google\Ads\AdManager\V1\CreatePlacementRequest;
use Google\Ads\AdManager\V1\Placement;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent      The parent resource where this `Placement` will be created.
 *                                     Format: `networks/{network_code}`
 *                                     Please see {@see PlacementServiceClient::networkName()} for help formatting this field.
 * @param string $placementDisplayName The display name of the placement. This attribute has a maximum
 *                                     length of 255 characters.
 */
function create_placement_sample(string $formattedParent, string $placementDisplayName): void
{
    // Create a client.
    $placementServiceClient = new PlacementServiceClient();

    // Prepare the request message.
    $placement = (new Placement())
        ->setDisplayName($placementDisplayName);
    $request = (new CreatePlacementRequest())
        ->setParent($formattedParent)
        ->setPlacement($placement);

    // Call the API and handle any network failures.
    try {
        /** @var Placement $response */
        $response = $placementServiceClient->createPlacement($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 = PlacementServiceClient::networkName('[NETWORK_CODE]');
    $placementDisplayName = '[DISPLAY_NAME]';

    create_placement_sample($formattedParent, $placementDisplayName);
}
```

### getPlacement

Retrieves a `Placement` object.

The async variant is [PlacementServiceClient::getPlacementAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.PlacementServiceClient.md.txt#_Google_Ads_AdManager_V1_Client_PlacementServiceClient__getPlacementAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\GetPlacementRequest` 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](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.md.txt) 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.md.txt) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Ads\AdManager\V1\Placement` |   |

**Example**

```php
use Google\Ads\AdManager\V1\Client\PlacementServiceClient;
use Google\Ads\AdManager\V1\GetPlacementRequest;
use Google\Ads\AdManager\V1\Placement;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The resource name of the Placement.
 *                              Format: `networks/{network_code}/placements/{placement_id}`
 *                              Please see {@see PlacementServiceClient::placementName()} for help formatting this field.
 */
function get_placement_sample(string $formattedName): void
{
    // Create a client.
    $placementServiceClient = new PlacementServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Placement $response */
        $response = $placementServiceClient->getPlacement($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 = PlacementServiceClient::placementName('[NETWORK_CODE]', '[PLACEMENT]');

    get_placement_sample($formattedName);
}
```

### listPlacements

Lists `Placement` objects.

The async variant is [PlacementServiceClient::listPlacementsAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.PlacementServiceClient.md.txt#_Google_Ads_AdManager_V1_Client_PlacementServiceClient__listPlacementsAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\ListPlacementsRequest` 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](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.md.txt) 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.md.txt) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\ApiCore\PagedListResponse` |   |

**Example**

```php
use Google\Ads\AdManager\V1\Client\PlacementServiceClient;
use Google\Ads\AdManager\V1\ListPlacementsRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

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

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

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

    list_placements_sample($formattedParent);
}
```

### updatePlacement

Updates an `Placement` object.

The async variant is [PlacementServiceClient::updatePlacementAsync()](https://docs.cloud.google.com/php/docs/reference/ad-manager/latest/V1.Client.PlacementServiceClient.md.txt#_Google_Ads_AdManager_V1_Client_PlacementServiceClient__updatePlacementAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\UpdatePlacementRequest` 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](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.md.txt) 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.md.txt) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Ads\AdManager\V1\Placement` |   |

**Example**

```php
use Google\Ads\AdManager\V1\Client\PlacementServiceClient;
use Google\Ads\AdManager\V1\Placement;
use Google\Ads\AdManager\V1\UpdatePlacementRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $placementDisplayName The display name of the placement. This attribute has a maximum
 *                                     length of 255 characters.
 */
function update_placement_sample(string $placementDisplayName): void
{
    // Create a client.
    $placementServiceClient = new PlacementServiceClient();

    // Prepare the request message.
    $placement = (new Placement())
        ->setDisplayName($placementDisplayName);
    $request = (new UpdatePlacementRequest())
        ->setPlacement($placement);

    // Call the API and handle any network failures.
    try {
        /** @var Placement $response */
        $response = $placementServiceClient->updatePlacement($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
{
    $placementDisplayName = '[DISPLAY_NAME]';

    update_placement_sample($placementDisplayName);
}
```

### batchActivatePlacementsAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\BatchActivatePlacementsRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchActivatePlacementsResponse>` |   |

### batchArchivePlacementsAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\BatchArchivePlacementsRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchArchivePlacementsResponse>` |   |

### batchCreatePlacementsAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\BatchCreatePlacementsRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchCreatePlacementsResponse>` |   |

### batchDeactivatePlacementsAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\BatchDeactivatePlacementsRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchDeactivatePlacementsResponse>` |   |

### batchUpdatePlacementsAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\BatchUpdatePlacementsRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchUpdatePlacementsResponse>` |   |

### createPlacementAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\CreatePlacementRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\Placement>` |   |

### getPlacementAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\GetPlacementRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\Placement>` |   |

### listPlacementsAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\ListPlacementsRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>` |   |

### updatePlacementAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Google\Ads\AdManager\V1\UpdatePlacementRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\Placement>` |   |

### static::adUnitName

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

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

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

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

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

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

- adUnit: networks/{network_code}/adUnits/{ad_unit}
- network: networks/{network_code}
- placement: networks/{network_code}/placements/{placement}

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