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

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

Service Description: Provides methods for handling Order objects.

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

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

Namespace

Google \ Ads \ AdManager \ V1 \ Client

Methods

__construct

Constructor.

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

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

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

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

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

↳ credentialsConfig array

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

↳ disableRetries bool

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

↳ clientConfig string|array

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

↳ transport string|Google\ApiCore\Transport\TransportInterface

The transport used for executing network requests. At the moment, supports only rest. Advanced usage: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ transportConfig array

Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'rest' => [...], ]; See the Google\ApiCore\Transport\RestTransport::build() method for the supported options.

↳ clientCertSource callable

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

↳ logger false|Psr\Log\LoggerInterface

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

↳ universeDomain string

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

batchApproveAndOverbookOrders

Approves and overbooks a list of Order objects.

The async variant is OrderServiceClient::batchApproveAndOverbookOrdersAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchApproveAndOverbookOrdersResponse
Example
use Google\Ads\AdManager\V1\BatchApproveAndOverbookOrdersRequest;
use Google\Ads\AdManager\V1\BatchApproveAndOverbookOrdersResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The parent, which owns this collection of Orders.
 *                                      Format: `networks/{network_code}`
 *                                      Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the orders to approve and overbook.
 *                                      Format: `networks/{network_code}/orders/{order_id}`
 *                                      Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function batch_approve_and_overbook_orders_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchApproveAndOverbookOrdersResponse $response */
        $response = $orderServiceClient->batchApproveAndOverbookOrders($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    batch_approve_and_overbook_orders_sample($formattedParent, $formattedNamesElement);
}

batchApproveOrders

Approves a list of Order objects.

The async variant is OrderServiceClient::batchApproveOrdersAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchApproveOrdersResponse
Example
use Google\Ads\AdManager\V1\BatchApproveOrdersRequest;
use Google\Ads\AdManager\V1\BatchApproveOrdersResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The parent, which owns this collection of Orders.
 *                                      Format: `networks/{network_code}`
 *                                      Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the orders to approve.
 *                                      Format: `networks/{network_code}/orders/{order_id}`
 *                                      Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function batch_approve_orders_sample(string $formattedParent, string $formattedNamesElement): void
{
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchApproveOrdersResponse $response */
        $response = $orderServiceClient->batchApproveOrders($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    batch_approve_orders_sample($formattedParent, $formattedNamesElement);
}

batchApproveOrdersWithoutReservation

Approves a list of Order objects without changing reservation status.

The async variant is OrderServiceClient::batchApproveOrdersWithoutReservationAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchApproveOrdersWithoutReservationResponse
Example
use Google\Ads\AdManager\V1\BatchApproveOrdersWithoutReservationRequest;
use Google\Ads\AdManager\V1\BatchApproveOrdersWithoutReservationResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The parent, which owns this collection of Orders.
 *                                      Format: `networks/{network_code}`
 *                                      Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the orders to approve.
 *                                      Format: `networks/{network_code}/orders/{order_id}`
 *                                      Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function batch_approve_orders_without_reservation_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchApproveOrdersWithoutReservationResponse $response */
        $response = $orderServiceClient->batchApproveOrdersWithoutReservation($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    batch_approve_orders_without_reservation_sample($formattedParent, $formattedNamesElement);
}

batchArchiveOrders

Archives a list of Order objects.

The async variant is OrderServiceClient::batchArchiveOrdersAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchArchiveOrdersResponse
Example
use Google\Ads\AdManager\V1\BatchArchiveOrdersRequest;
use Google\Ads\AdManager\V1\BatchArchiveOrdersResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The parent, which owns this collection of Orders.
 *                                      Format: `networks/{network_code}`
 *                                      Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the orders to archive.
 *                                      Format: `networks/{network_code}/orders/{order_id}`
 *                                      Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function batch_archive_orders_sample(string $formattedParent, string $formattedNamesElement): void
{
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchArchiveOrdersResponse $response */
        $response = $orderServiceClient->batchArchiveOrders($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    batch_archive_orders_sample($formattedParent, $formattedNamesElement);
}

batchCreateOrders

Creates Order objects.

The async variant is OrderServiceClient::batchCreateOrdersAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchCreateOrdersResponse
Example
use Google\Ads\AdManager\V1\BatchCreateOrdersRequest;
use Google\Ads\AdManager\V1\BatchCreateOrdersResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\Ads\AdManager\V1\CreateOrderRequest;
use Google\Ads\AdManager\V1\Order;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent                  The parent resource where `Orders` will be created.
 *                                                 Format: `networks/{network_code}`
 *                                                 The parent field in the CreateOrderRequest must match this
 *                                                 field. Please see
 *                                                 {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedRequestsParent          The parent resource where this Order will be created.
 *                                                 Format: `networks/{network_code}`
 *                                                 Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $requestsOrderDisplayName         The display name of the Order.  This value has a maximum length
 *                                                 of 255 characters.
 * @param string $formattedRequestsOrderTrafficker The resource name of the User responsible for trafficking the
 *                                                 Order. Format: "networks/{network_code}/users/{user_id}"
 *                                                 Please see {@see OrderServiceClient::userName()} for help formatting this field.
 * @param string $formattedRequestsOrderAdvertiser The resource name of the Company, which is of type
 *                                                 Company.Type.ADVERTISER, to which this order belongs. Format:
 *                                                 "networks/{network_code}/companies/{company_id}"
 *                                                 Please see {@see OrderServiceClient::companyName()} for help formatting this field.
 */
function batch_create_orders_sample(
    string $formattedParent,
    string $formattedRequestsParent,
    string $requestsOrderDisplayName,
    string $formattedRequestsOrderTrafficker,
    string $formattedRequestsOrderAdvertiser
): void {
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

    // Prepare the request message.
    $requestsOrder = (new Order())
        ->setDisplayName($requestsOrderDisplayName)
        ->setTrafficker($formattedRequestsOrderTrafficker)
        ->setAdvertiser($formattedRequestsOrderAdvertiser);
    $createOrderRequest = (new CreateOrderRequest())
        ->setParent($formattedRequestsParent)
        ->setOrder($requestsOrder);
    $requests = [$createOrderRequest,];
    $request = (new BatchCreateOrdersRequest())
        ->setParent($formattedParent)
        ->setRequests($requests);

    // Call the API and handle any network failures.
    try {
        /** @var BatchCreateOrdersResponse $response */
        $response = $orderServiceClient->batchCreateOrders($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedRequestsParent = OrderServiceClient::networkName('[NETWORK_CODE]');
    $requestsOrderDisplayName = '[DISPLAY_NAME]';
    $formattedRequestsOrderTrafficker = OrderServiceClient::userName('[NETWORK_CODE]', '[USER]');
    $formattedRequestsOrderAdvertiser = OrderServiceClient::companyName('[NETWORK_CODE]', '[COMPANY]');

    batch_create_orders_sample(
        $formattedParent,
        $formattedRequestsParent,
        $requestsOrderDisplayName,
        $formattedRequestsOrderTrafficker,
        $formattedRequestsOrderAdvertiser
    );
}

batchDeleteOrders

Deletes a list of Order objects.

The async variant is OrderServiceClient::batchDeleteOrdersAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchDeleteOrdersResponse
Example
use Google\Ads\AdManager\V1\BatchDeleteOrdersRequest;
use Google\Ads\AdManager\V1\BatchDeleteOrdersResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The parent, which owns this collection of Orders.
 *                                      Format: `networks/{network_code}`
 *                                      Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the orders to delete.
 *                                      Format: `networks/{network_code}/orders/{order_id}`
 *                                      Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function batch_delete_orders_sample(string $formattedParent, string $formattedNamesElement): void
{
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchDeleteOrdersResponse $response */
        $response = $orderServiceClient->batchDeleteOrders($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    batch_delete_orders_sample($formattedParent, $formattedNamesElement);
}

batchDisapproveOrders

Disapproves a list of Order objects.

The async variant is OrderServiceClient::batchDisapproveOrdersAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchDisapproveOrdersResponse
Example
use Google\Ads\AdManager\V1\BatchDisapproveOrdersRequest;
use Google\Ads\AdManager\V1\BatchDisapproveOrdersResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The parent, which owns this collection of Orders.
 *                                      Format: `networks/{network_code}`
 *                                      Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the orders to disapprove.
 *                                      Format: `networks/{network_code}/orders/{order_id}`
 *                                      Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function batch_disapprove_orders_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchDisapproveOrdersResponse $response */
        $response = $orderServiceClient->batchDisapproveOrders($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    batch_disapprove_orders_sample($formattedParent, $formattedNamesElement);
}

batchDisapproveOrdersWithoutReservationChanges

Disapproves a list of Order objects without changing reservation status.

The async variant is OrderServiceClient::batchDisapproveOrdersWithoutReservationChangesAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchDisapproveOrdersWithoutReservationChangesResponse
Example
use Google\Ads\AdManager\V1\BatchDisapproveOrdersWithoutReservationChangesRequest;
use Google\Ads\AdManager\V1\BatchDisapproveOrdersWithoutReservationChangesResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The parent, which owns this collection of Orders.
 *                                      Format: `networks/{network_code}`
 *                                      Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the orders to disapprove without
 *                                      reservation changes. Format: `networks/{network_code}/orders/{order_id}`
 *                                      Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function batch_disapprove_orders_without_reservation_changes_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchDisapproveOrdersWithoutReservationChangesResponse $response */
        $response = $orderServiceClient->batchDisapproveOrdersWithoutReservationChanges($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    batch_disapprove_orders_without_reservation_changes_sample(
        $formattedParent,
        $formattedNamesElement
    );
}

batchPauseOrders

Pauses a list of Order objects.

The async variant is OrderServiceClient::batchPauseOrdersAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchPauseOrdersResponse
Example
use Google\Ads\AdManager\V1\BatchPauseOrdersRequest;
use Google\Ads\AdManager\V1\BatchPauseOrdersResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The parent, which owns this collection of Orders.
 *                                      Format: `networks/{network_code}`
 *                                      Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the orders to pause.
 *                                      Format: `networks/{network_code}/orders/{order_id}`
 *                                      Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function batch_pause_orders_sample(string $formattedParent, string $formattedNamesElement): void
{
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchPauseOrdersResponse $response */
        $response = $orderServiceClient->batchPauseOrders($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    batch_pause_orders_sample($formattedParent, $formattedNamesElement);
}

batchResumeAndOverbookOrders

Resumes and overbooks a list of Order objects.

The async variant is OrderServiceClient::batchResumeAndOverbookOrdersAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchResumeAndOverbookOrdersResponse
Example
use Google\Ads\AdManager\V1\BatchResumeAndOverbookOrdersRequest;
use Google\Ads\AdManager\V1\BatchResumeAndOverbookOrdersResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The parent, which owns this collection of Orders.
 *                                      Format: `networks/{network_code}`
 *                                      Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the orders to resume and overbook.
 *                                      Format: `networks/{network_code}/orders/{order_id}`
 *                                      Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function batch_resume_and_overbook_orders_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchResumeAndOverbookOrdersResponse $response */
        $response = $orderServiceClient->batchResumeAndOverbookOrders($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    batch_resume_and_overbook_orders_sample($formattedParent, $formattedNamesElement);
}

batchResumeOrders

Resumes a list of Order objects.

The async variant is OrderServiceClient::batchResumeOrdersAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchResumeOrdersResponse
Example
use Google\Ads\AdManager\V1\BatchResumeOrdersRequest;
use Google\Ads\AdManager\V1\BatchResumeOrdersResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The parent, which owns this collection of Orders.
 *                                      Format: `networks/{network_code}`
 *                                      Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the orders to resume.
 *                                      Format: `networks/{network_code}/orders/{order_id}`
 *                                      Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function batch_resume_orders_sample(string $formattedParent, string $formattedNamesElement): void
{
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchResumeOrdersResponse $response */
        $response = $orderServiceClient->batchResumeOrders($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    batch_resume_orders_sample($formattedParent, $formattedNamesElement);
}

batchRetractOrders

Retracts a list of Order objects.

The async variant is OrderServiceClient::batchRetractOrdersAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchRetractOrdersResponse
Example
use Google\Ads\AdManager\V1\BatchRetractOrdersRequest;
use Google\Ads\AdManager\V1\BatchRetractOrdersResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The parent, which owns this collection of Orders.
 *                                      Format: `networks/{network_code}`
 *                                      Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the orders to retract.
 *                                      Format: `networks/{network_code}/orders/{order_id}`
 *                                      Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function batch_retract_orders_sample(string $formattedParent, string $formattedNamesElement): void
{
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchRetractOrdersResponse $response */
        $response = $orderServiceClient->batchRetractOrders($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    batch_retract_orders_sample($formattedParent, $formattedNamesElement);
}

batchRetractOrdersWithoutReservationChanges

Retracts a list of Order objects without changing reservation status.

The async variant is OrderServiceClient::batchRetractOrdersWithoutReservationChangesAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchRetractOrdersWithoutReservationChangesResponse
Example
use Google\Ads\AdManager\V1\BatchRetractOrdersWithoutReservationChangesRequest;
use Google\Ads\AdManager\V1\BatchRetractOrdersWithoutReservationChangesResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The parent, which owns this collection of Orders.
 *                                      Format: `networks/{network_code}`
 *                                      Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the orders to retract.
 *                                      Format: `networks/{network_code}/orders/{order_id}`
 *                                      Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function batch_retract_orders_without_reservation_changes_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchRetractOrdersWithoutReservationChangesResponse $response */
        $response = $orderServiceClient->batchRetractOrdersWithoutReservationChanges($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    batch_retract_orders_without_reservation_changes_sample($formattedParent, $formattedNamesElement);
}

batchSubmitOrdersForApproval

Submits a list of Order objects for approval.

The async variant is OrderServiceClient::batchSubmitOrdersForApprovalAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchSubmitOrdersForApprovalResponse
Example
use Google\Ads\AdManager\V1\BatchSubmitOrdersForApprovalRequest;
use Google\Ads\AdManager\V1\BatchSubmitOrdersForApprovalResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The parent, which owns this collection of Orders.
 *                                      Format: `networks/{network_code}`
 *                                      Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the orders to submit for approval.
 *                                      Format: `networks/{network_code}/orders/{order_id}`
 *                                      Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function batch_submit_orders_for_approval_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchSubmitOrdersForApprovalResponse $response */
        $response = $orderServiceClient->batchSubmitOrdersForApproval($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    batch_submit_orders_for_approval_sample($formattedParent, $formattedNamesElement);
}

batchSubmitOrdersForApprovalAndOverbook

Submits and overbooks a list of Order objects for approval.

The async variant is OrderServiceClient::batchSubmitOrdersForApprovalAndOverbookAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchSubmitOrdersForApprovalAndOverbookResponse
Example
use Google\Ads\AdManager\V1\BatchSubmitOrdersForApprovalAndOverbookRequest;
use Google\Ads\AdManager\V1\BatchSubmitOrdersForApprovalAndOverbookResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       Format: `networks/{network_code}`
 *                                      Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the orders to submit for approval and
 *                                      overbook. Format: `networks/{network_code}/orders/{order_id}`
 *                                      Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function batch_submit_orders_for_approval_and_overbook_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchSubmitOrdersForApprovalAndOverbookResponse $response */
        $response = $orderServiceClient->batchSubmitOrdersForApprovalAndOverbook($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    batch_submit_orders_for_approval_and_overbook_sample($formattedParent, $formattedNamesElement);
}

batchSubmitOrdersForApprovalWithoutReservationChanges

Submits a list of Order objects for approval without changing reservation status.

The async variant is OrderServiceClient::batchSubmitOrdersForApprovalWithoutReservationChangesAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchSubmitOrdersForApprovalWithoutReservationChangesResponse
Example
use Google\Ads\AdManager\V1\BatchSubmitOrdersForApprovalWithoutReservationChangesRequest;
use Google\Ads\AdManager\V1\BatchSubmitOrdersForApprovalWithoutReservationChangesResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The parent, which owns this collection of Orders.
 *                                      Format: `networks/{network_code}`
 *                                      Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the orders to submit for approval.
 *                                      Format: `networks/{network_code}/orders/{order_id}`
 *                                      Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function batch_submit_orders_for_approval_without_reservation_changes_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchSubmitOrdersForApprovalWithoutReservationChangesResponse $response */
        $response = $orderServiceClient->batchSubmitOrdersForApprovalWithoutReservationChanges($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    batch_submit_orders_for_approval_without_reservation_changes_sample(
        $formattedParent,
        $formattedNamesElement
    );
}

batchUnarchiveOrders

Unarchives a list of Order objects.

The async variant is OrderServiceClient::batchUnarchiveOrdersAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchUnarchiveOrdersResponse
Example
use Google\Ads\AdManager\V1\BatchUnarchiveOrdersRequest;
use Google\Ads\AdManager\V1\BatchUnarchiveOrdersResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       The parent, which owns this collection of Orders.
 *                                      Format: `networks/{network_code}`
 *                                      Please see {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the orders to extract.
 *                                      Format: `networks/{network_code}/orders/{order_id}`
 *                                      Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function batch_unarchive_orders_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var BatchUnarchiveOrdersResponse $response */
        $response = $orderServiceClient->batchUnarchiveOrders($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    batch_unarchive_orders_sample($formattedParent, $formattedNamesElement);
}

batchUpdateOrders

Batch updates Order objects.

The async variant is OrderServiceClient::batchUpdateOrdersAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\BatchUpdateOrdersResponse
Example
use Google\Ads\AdManager\V1\BatchUpdateOrdersRequest;
use Google\Ads\AdManager\V1\BatchUpdateOrdersResponse;
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\Ads\AdManager\V1\Order;
use Google\Ads\AdManager\V1\UpdateOrderRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent                  The parent resource where `Orders` will be updated.
 *                                                 Format: `networks/{network_code}`
 *                                                 The parent field in the UpdateOrderRequest must match this
 *                                                 field. Please see
 *                                                 {@see OrderServiceClient::networkName()} for help formatting this field.
 * @param string $requestsOrderDisplayName         The display name of the Order.  This value has a maximum length
 *                                                 of 255 characters.
 * @param string $formattedRequestsOrderTrafficker The resource name of the User responsible for trafficking the
 *                                                 Order. Format: "networks/{network_code}/users/{user_id}"
 *                                                 Please see {@see OrderServiceClient::userName()} for help formatting this field.
 * @param string $formattedRequestsOrderAdvertiser The resource name of the Company, which is of type
 *                                                 Company.Type.ADVERTISER, to which this order belongs. Format:
 *                                                 "networks/{network_code}/companies/{company_id}"
 *                                                 Please see {@see OrderServiceClient::companyName()} for help formatting this field.
 */
function batch_update_orders_sample(
    string $formattedParent,
    string $requestsOrderDisplayName,
    string $formattedRequestsOrderTrafficker,
    string $formattedRequestsOrderAdvertiser
): void {
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

    // Prepare the request message.
    $requestsOrder = (new Order())
        ->setDisplayName($requestsOrderDisplayName)
        ->setTrafficker($formattedRequestsOrderTrafficker)
        ->setAdvertiser($formattedRequestsOrderAdvertiser);
    $updateOrderRequest = (new UpdateOrderRequest())
        ->setOrder($requestsOrder);
    $requests = [$updateOrderRequest,];
    $request = (new BatchUpdateOrdersRequest())
        ->setParent($formattedParent)
        ->setRequests($requests);

    // Call the API and handle any network failures.
    try {
        /** @var BatchUpdateOrdersResponse $response */
        $response = $orderServiceClient->batchUpdateOrders($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 = OrderServiceClient::networkName('[NETWORK_CODE]');
    $requestsOrderDisplayName = '[DISPLAY_NAME]';
    $formattedRequestsOrderTrafficker = OrderServiceClient::userName('[NETWORK_CODE]', '[USER]');
    $formattedRequestsOrderAdvertiser = OrderServiceClient::companyName('[NETWORK_CODE]', '[COMPANY]');

    batch_update_orders_sample(
        $formattedParent,
        $requestsOrderDisplayName,
        $formattedRequestsOrderTrafficker,
        $formattedRequestsOrderAdvertiser
    );
}

getOrder

Retrieves an Order object.

The async variant is OrderServiceClient::getOrderAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\Ads\AdManager\V1\Order
Example
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\Ads\AdManager\V1\GetOrderRequest;
use Google\Ads\AdManager\V1\Order;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The resource name of the Order.
 *                              Format: `networks/{network_code}/orders/{order_id}`
 *                              Please see {@see OrderServiceClient::orderName()} for help formatting this field.
 */
function get_order_sample(string $formattedName): void
{
    // Create a client.
    $orderServiceClient = new OrderServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Order $response */
        $response = $orderServiceClient->getOrder($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 = OrderServiceClient::orderName('[NETWORK_CODE]', '[ORDER]');

    get_order_sample($formattedName);
}

listOrders

Lists Order objects.

Fields used for literal matching in filter string:

  • order_id
  • display_name
  • external_order_id

The async variant is OrderServiceClient::listOrdersAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Ads\AdManager\V1\Client\OrderServiceClient;
use Google\Ads\AdManager\V1\ListOrdersRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

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

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

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

    list_orders_sample($formattedParent);
}

batchApproveAndOverbookOrdersAsync

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

batchApproveOrdersAsync

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

batchApproveOrdersWithoutReservationAsync

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

batchArchiveOrdersAsync

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

batchCreateOrdersAsync

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

batchDeleteOrdersAsync

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

batchDisapproveOrdersAsync

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

batchDisapproveOrdersWithoutReservationChangesAsync

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

batchPauseOrdersAsync

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

batchResumeAndOverbookOrdersAsync

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

batchResumeOrdersAsync

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

batchRetractOrdersAsync

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

batchRetractOrdersWithoutReservationChangesAsync

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

batchSubmitOrdersForApprovalAsync

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

batchSubmitOrdersForApprovalAndOverbookAsync

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

batchSubmitOrdersForApprovalWithoutReservationChangesAsync

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

batchUnarchiveOrdersAsync

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

batchUpdateOrdersAsync

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

getOrderAsync

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

listOrdersAsync

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

static::companyName

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

Parameters
Name Description
networkCode string
company string
Returns
Type Description
string The formatted company resource.

static::contactName

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

Parameters
Name Description
networkCode string
contact string
Returns
Type Description
string The formatted contact resource.

static::customFieldName

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

Parameters
Name Description
networkCode string
customField string
Returns
Type Description
string The formatted custom_field resource.

static::labelName

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

Parameters
Name Description
networkCode string
label string
Returns
Type Description
string The formatted label 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::orderName

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

Parameters
Name Description
networkCode string
order string
Returns
Type Description
string The formatted order resource.

static::teamName

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

Parameters
Name Description
networkCode string
team string
Returns
Type Description
string The formatted team resource.

static::userName

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

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

  • company: networks/{network_code}/companies/{company}
  • contact: networks/{network_code}/contacts/{contact}
  • customField: networks/{network_code}/customFields/{custom_field}
  • label: networks/{network_code}/labels/{label}
  • network: networks/{network_code}
  • order: networks/{network_code}/orders/{order}
  • team: networks/{network_code}/teams/{team}
  • user: networks/{network_code}/users/{user}

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.