Reference documentation and code samples for the Google Ads Ad Manager V1 Client class ChildPublisherServiceClient.
Service Description: Provides methods for handling ChildPublisher 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 \ ClientMethods
__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 |
↳ 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 |
↳ 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 |
↳ 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'. |
batchCreateChildPublishers
Creates ChildPublisher objects.
The async variant is ChildPublisherServiceClient::batchCreateChildPublishersAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\BatchCreateChildPublishersRequest
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\BatchCreateChildPublishersResponse |
|
use Google\Ads\AdManager\V1\BatchCreateChildPublishersRequest;
use Google\Ads\AdManager\V1\BatchCreateChildPublishersResponse;
use Google\Ads\AdManager\V1\ChildPublisher;
use Google\Ads\AdManager\V1\Client\ChildPublisherServiceClient;
use Google\Ads\AdManager\V1\CreateChildPublisherRequest;
use Google\Ads\AdManager\V1\DelegationTypeEnum\DelegationType;
use Google\ApiCore\ApiException;
/**
* @param string $formattedParent The parent resource where
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher]s will be created.
* Format: `networks/{network_code}`
* The parent field in the CreateChildPublisherRequest must match this
* field. Please see
* {@see ChildPublisherServiceClient::networkName()} for help formatting this field.
* @param string $formattedRequestsParent The parent resource where this
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher] will be created.
* Format: `networks/{network_code}`
* Please see {@see ChildPublisherServiceClient::networkName()} for help formatting this field.
* @param string $requestsChildPublisherDisplayName The display name of the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher].
* @param string $requestsChildPublisherEmail The email for the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher].
* @param int $requestsChildPublisherDelegationType The type of delegation for the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher].
*
* This attribute is immutable while the relationship is active.
*/
function batch_create_child_publishers_sample(
string $formattedParent,
string $formattedRequestsParent,
string $requestsChildPublisherDisplayName,
string $requestsChildPublisherEmail,
int $requestsChildPublisherDelegationType
): void {
// Create a client.
$childPublisherServiceClient = new ChildPublisherServiceClient();
// Prepare the request message.
$requestsChildPublisher = (new ChildPublisher())
->setDisplayName($requestsChildPublisherDisplayName)
->setEmail($requestsChildPublisherEmail)
->setDelegationType($requestsChildPublisherDelegationType);
$createChildPublisherRequest = (new CreateChildPublisherRequest())
->setParent($formattedRequestsParent)
->setChildPublisher($requestsChildPublisher);
$requests = [$createChildPublisherRequest,];
$request = (new BatchCreateChildPublishersRequest())
->setParent($formattedParent)
->setRequests($requests);
// Call the API and handle any network failures.
try {
/** @var BatchCreateChildPublishersResponse $response */
$response = $childPublisherServiceClient->batchCreateChildPublishers($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 = ChildPublisherServiceClient::networkName('[NETWORK_CODE]');
$formattedRequestsParent = ChildPublisherServiceClient::networkName('[NETWORK_CODE]');
$requestsChildPublisherDisplayName = '[DISPLAY_NAME]';
$requestsChildPublisherEmail = '[EMAIL]';
$requestsChildPublisherDelegationType = DelegationType::DELEGATION_TYPE_UNSPECIFIED;
batch_create_child_publishers_sample(
$formattedParent,
$formattedRequestsParent,
$requestsChildPublisherDisplayName,
$requestsChildPublisherEmail,
$requestsChildPublisherDelegationType
);
}
batchRejectChildPublishers
Batch rejects ChildPublishers.
Only pending or active ChildPublishers can be rejected. Expired, rejected, and withdrawn ChildPublishers will be ignored.
This method is only intended to be called in response to a child user rejecting an invitation and exists to support the rejection of ChildPublishers that are not yet associated with an Ad Manager network.
To sever the relationship from the parent publisher's side, use BatchWithdrawChildPublisher.
The async variant is ChildPublisherServiceClient::batchRejectChildPublishersAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\BatchRejectChildPublishersRequest
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\BatchRejectChildPublishersResponse |
|
use Google\Ads\AdManager\V1\BatchRejectChildPublishersRequest;
use Google\Ads\AdManager\V1\BatchRejectChildPublishersResponse;
use Google\Ads\AdManager\V1\Client\ChildPublisherServiceClient;
use Google\ApiCore\ApiException;
/**
* @param string $formattedParent Format: `networks/{network_code}`
* Please see {@see ChildPublisherServiceClient::networkName()} for help formatting this field.
* @param string $formattedNamesElement Resource names of the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher]s to reject.
* Format: `networks/{network_code}/childPublisher/{child_publisher_id}`
* Please see {@see ChildPublisherServiceClient::childPublisherName()} for help formatting this field.
*/
function batch_reject_child_publishers_sample(
string $formattedParent,
string $formattedNamesElement
): void {
// Create a client.
$childPublisherServiceClient = new ChildPublisherServiceClient();
// Prepare the request message.
$formattedNames = [$formattedNamesElement,];
$request = (new BatchRejectChildPublishersRequest())
->setParent($formattedParent)
->setNames($formattedNames);
// Call the API and handle any network failures.
try {
/** @var BatchRejectChildPublishersResponse $response */
$response = $childPublisherServiceClient->batchRejectChildPublishers($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 = ChildPublisherServiceClient::networkName('[NETWORK_CODE]');
$formattedNamesElement = ChildPublisherServiceClient::childPublisherName(
'[NETWORK_CODE]',
'[CHILD_PUBLISHER]'
);
batch_reject_child_publishers_sample($formattedParent, $formattedNamesElement);
}
batchRenegotiateChildPublisherAgreements
Batch renegotiates ChildPublisher agreements (i.e., invite with updated terms).
Only the agreements of rejected or withdrawn ChildPublishers can be renegotiated. Expired, pending, and accepted ChildPublishers will be ignored.
The async variant is ChildPublisherServiceClient::batchRenegotiateChildPublisherAgreementsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\BatchRenegotiateChildPublisherAgreementsRequest
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\BatchRenegotiateChildPublisherAgreementsResponse |
|
use Google\Ads\AdManager\V1\BatchRenegotiateChildPublisherAgreementsRequest;
use Google\Ads\AdManager\V1\BatchRenegotiateChildPublisherAgreementsResponse;
use Google\Ads\AdManager\V1\Client\ChildPublisherServiceClient;
use Google\Ads\AdManager\V1\RenegotiateChildPublisherAgreementRequest;
use Google\ApiCore\ApiException;
/**
* @param string $formattedParent Format: `networks/{network_code}`
* Please see {@see ChildPublisherServiceClient::networkName()} for help formatting this field.
* @param string $formattedRequestsName Resource name of the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher] whose agreement is
* being renegotiated. Format:
* `networks/{network_code}/childPublisher/{child_publisher_id}`
* Please see {@see ChildPublisherServiceClient::childPublisherName()} for help formatting this field.
*/
function batch_renegotiate_child_publisher_agreements_sample(
string $formattedParent,
string $formattedRequestsName
): void {
// Create a client.
$childPublisherServiceClient = new ChildPublisherServiceClient();
// Prepare the request message.
$renegotiateChildPublisherAgreementRequest = (new RenegotiateChildPublisherAgreementRequest())
->setName($formattedRequestsName);
$requests = [$renegotiateChildPublisherAgreementRequest,];
$request = (new BatchRenegotiateChildPublisherAgreementsRequest())
->setParent($formattedParent)
->setRequests($requests);
// Call the API and handle any network failures.
try {
/** @var BatchRenegotiateChildPublisherAgreementsResponse $response */
$response = $childPublisherServiceClient->batchRenegotiateChildPublisherAgreements($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 = ChildPublisherServiceClient::networkName('[NETWORK_CODE]');
$formattedRequestsName = ChildPublisherServiceClient::childPublisherName(
'[NETWORK_CODE]',
'[CHILD_PUBLISHER]'
);
batch_renegotiate_child_publisher_agreements_sample($formattedParent, $formattedRequestsName);
}
batchResendChildPublisherInvitationEmails
Batch resends invitation emails to ChildPublishers.
Only expired and pending ChildPublishers can be sent invitation emails. Rejected, withdrawn, and accepted ChildPublishers will be ignored.
The async variant is ChildPublisherServiceClient::batchResendChildPublisherInvitationEmailsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\BatchResendChildPublisherInvitationEmailsRequest
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\BatchResendChildPublisherInvitationEmailsResponse |
|
use Google\Ads\AdManager\V1\BatchResendChildPublisherInvitationEmailsRequest;
use Google\Ads\AdManager\V1\BatchResendChildPublisherInvitationEmailsResponse;
use Google\Ads\AdManager\V1\Client\ChildPublisherServiceClient;
use Google\ApiCore\ApiException;
/**
* @param string $formattedParent Format: `networks/{network_code}`
* Please see {@see ChildPublisherServiceClient::networkName()} for help formatting this field.
* @param string $formattedNamesElement Resource names of the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher]s that should be
* resent invitation emails. Format:
* `networks/{network_code}/childPublisher/{child_publisher_id}`
* Please see {@see ChildPublisherServiceClient::childPublisherName()} for help formatting this field.
*/
function batch_resend_child_publisher_invitation_emails_sample(
string $formattedParent,
string $formattedNamesElement
): void {
// Create a client.
$childPublisherServiceClient = new ChildPublisherServiceClient();
// Prepare the request message.
$formattedNames = [$formattedNamesElement,];
$request = (new BatchResendChildPublisherInvitationEmailsRequest())
->setParent($formattedParent)
->setNames($formattedNames);
// Call the API and handle any network failures.
try {
/** @var BatchResendChildPublisherInvitationEmailsResponse $response */
$response = $childPublisherServiceClient->batchResendChildPublisherInvitationEmails($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 = ChildPublisherServiceClient::networkName('[NETWORK_CODE]');
$formattedNamesElement = ChildPublisherServiceClient::childPublisherName(
'[NETWORK_CODE]',
'[CHILD_PUBLISHER]'
);
batch_resend_child_publisher_invitation_emails_sample($formattedParent, $formattedNamesElement);
}
batchUpdateChildPublishers
Batch updates ChildPublisher objects.
The async variant is ChildPublisherServiceClient::batchUpdateChildPublishersAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\BatchUpdateChildPublishersRequest
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\BatchUpdateChildPublishersResponse |
|
use Google\Ads\AdManager\V1\BatchUpdateChildPublishersRequest;
use Google\Ads\AdManager\V1\BatchUpdateChildPublishersResponse;
use Google\Ads\AdManager\V1\ChildPublisher;
use Google\Ads\AdManager\V1\Client\ChildPublisherServiceClient;
use Google\Ads\AdManager\V1\DelegationTypeEnum\DelegationType;
use Google\Ads\AdManager\V1\UpdateChildPublisherRequest;
use Google\ApiCore\ApiException;
/**
* @param string $formattedParent The parent resource where
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher]s will be updated.
* Format: `networks/{network_code}`
* The parent field in the UpdateChildPublisherRequest must match this
* field. Please see
* {@see ChildPublisherServiceClient::networkName()} for help formatting this field.
* @param string $requestsChildPublisherDisplayName The display name of the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher].
* @param string $requestsChildPublisherEmail The email for the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher].
* @param int $requestsChildPublisherDelegationType The type of delegation for the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher].
*
* This attribute is immutable while the relationship is active.
*/
function batch_update_child_publishers_sample(
string $formattedParent,
string $requestsChildPublisherDisplayName,
string $requestsChildPublisherEmail,
int $requestsChildPublisherDelegationType
): void {
// Create a client.
$childPublisherServiceClient = new ChildPublisherServiceClient();
// Prepare the request message.
$requestsChildPublisher = (new ChildPublisher())
->setDisplayName($requestsChildPublisherDisplayName)
->setEmail($requestsChildPublisherEmail)
->setDelegationType($requestsChildPublisherDelegationType);
$updateChildPublisherRequest = (new UpdateChildPublisherRequest())
->setChildPublisher($requestsChildPublisher);
$requests = [$updateChildPublisherRequest,];
$request = (new BatchUpdateChildPublishersRequest())
->setParent($formattedParent)
->setRequests($requests);
// Call the API and handle any network failures.
try {
/** @var BatchUpdateChildPublishersResponse $response */
$response = $childPublisherServiceClient->batchUpdateChildPublishers($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 = ChildPublisherServiceClient::networkName('[NETWORK_CODE]');
$requestsChildPublisherDisplayName = '[DISPLAY_NAME]';
$requestsChildPublisherEmail = '[EMAIL]';
$requestsChildPublisherDelegationType = DelegationType::DELEGATION_TYPE_UNSPECIFIED;
batch_update_child_publishers_sample(
$formattedParent,
$requestsChildPublisherDisplayName,
$requestsChildPublisherEmail,
$requestsChildPublisherDelegationType
);
}
batchWithdrawChildPublishers
Batch withdraws ChildPublishers.
Only expired, pending, and accepted ChildPublishers can be withdrawn. Rejected or withdrawn ChildPublishers will be ignored.
The async variant is ChildPublisherServiceClient::batchWithdrawChildPublishersAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\BatchWithdrawChildPublishersRequest
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\BatchWithdrawChildPublishersResponse |
|
use Google\Ads\AdManager\V1\BatchWithdrawChildPublishersRequest;
use Google\Ads\AdManager\V1\BatchWithdrawChildPublishersResponse;
use Google\Ads\AdManager\V1\Client\ChildPublisherServiceClient;
use Google\ApiCore\ApiException;
/**
* @param string $formattedParent Format: `networks/{network_code}`
* Please see {@see ChildPublisherServiceClient::networkName()} for help formatting this field.
* @param string $formattedNamesElement Resource names of the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher]s to withdraw.
* Format: `networks/{network_code}/childPublisher/{child_publisher_id}`
* Please see {@see ChildPublisherServiceClient::childPublisherName()} for help formatting this field.
*/
function batch_withdraw_child_publishers_sample(
string $formattedParent,
string $formattedNamesElement
): void {
// Create a client.
$childPublisherServiceClient = new ChildPublisherServiceClient();
// Prepare the request message.
$formattedNames = [$formattedNamesElement,];
$request = (new BatchWithdrawChildPublishersRequest())
->setParent($formattedParent)
->setNames($formattedNames);
// Call the API and handle any network failures.
try {
/** @var BatchWithdrawChildPublishersResponse $response */
$response = $childPublisherServiceClient->batchWithdrawChildPublishers($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 = ChildPublisherServiceClient::networkName('[NETWORK_CODE]');
$formattedNamesElement = ChildPublisherServiceClient::childPublisherName(
'[NETWORK_CODE]',
'[CHILD_PUBLISHER]'
);
batch_withdraw_child_publishers_sample($formattedParent, $formattedNamesElement);
}
createChildPublisher
Creates a ChildPublisher object.
The async variant is ChildPublisherServiceClient::createChildPublisherAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\CreateChildPublisherRequest
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\ChildPublisher |
|
use Google\Ads\AdManager\V1\ChildPublisher;
use Google\Ads\AdManager\V1\Client\ChildPublisherServiceClient;
use Google\Ads\AdManager\V1\CreateChildPublisherRequest;
use Google\Ads\AdManager\V1\DelegationTypeEnum\DelegationType;
use Google\ApiCore\ApiException;
/**
* @param string $formattedParent The parent resource where this
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher] will be created.
* Format: `networks/{network_code}`
* Please see {@see ChildPublisherServiceClient::networkName()} for help formatting this field.
* @param string $childPublisherDisplayName The display name of the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher].
* @param string $childPublisherEmail The email for the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher].
* @param int $childPublisherDelegationType The type of delegation for the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher].
*
* This attribute is immutable while the relationship is active.
*/
function create_child_publisher_sample(
string $formattedParent,
string $childPublisherDisplayName,
string $childPublisherEmail,
int $childPublisherDelegationType
): void {
// Create a client.
$childPublisherServiceClient = new ChildPublisherServiceClient();
// Prepare the request message.
$childPublisher = (new ChildPublisher())
->setDisplayName($childPublisherDisplayName)
->setEmail($childPublisherEmail)
->setDelegationType($childPublisherDelegationType);
$request = (new CreateChildPublisherRequest())
->setParent($formattedParent)
->setChildPublisher($childPublisher);
// Call the API and handle any network failures.
try {
/** @var ChildPublisher $response */
$response = $childPublisherServiceClient->createChildPublisher($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 = ChildPublisherServiceClient::networkName('[NETWORK_CODE]');
$childPublisherDisplayName = '[DISPLAY_NAME]';
$childPublisherEmail = '[EMAIL]';
$childPublisherDelegationType = DelegationType::DELEGATION_TYPE_UNSPECIFIED;
create_child_publisher_sample(
$formattedParent,
$childPublisherDisplayName,
$childPublisherEmail,
$childPublisherDelegationType
);
}
getChildPublisher
Retrieves a ChildPublisher object.
The async variant is ChildPublisherServiceClient::getChildPublisherAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\GetChildPublisherRequest
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\ChildPublisher |
|
use Google\Ads\AdManager\V1\ChildPublisher;
use Google\Ads\AdManager\V1\Client\ChildPublisherServiceClient;
use Google\Ads\AdManager\V1\GetChildPublisherRequest;
use Google\ApiCore\ApiException;
/**
* @param string $formattedName The resource name of the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher]. Format:
* `networks/{network_code}/childPublishers/{child_publisher_id}`
* Please see {@see ChildPublisherServiceClient::childPublisherName()} for help formatting this field.
*/
function get_child_publisher_sample(string $formattedName): void
{
// Create a client.
$childPublisherServiceClient = new ChildPublisherServiceClient();
// Prepare the request message.
$request = (new GetChildPublisherRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var ChildPublisher $response */
$response = $childPublisherServiceClient->getChildPublisher($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 = ChildPublisherServiceClient::childPublisherName(
'[NETWORK_CODE]',
'[CHILD_PUBLISHER]'
);
get_child_publisher_sample($formattedName);
}
listChildPublishers
Lists ChildPublisher objects.
The async variant is ChildPublisherServiceClient::listChildPublishersAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\ListChildPublishersRequest
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 |
|
use Google\Ads\AdManager\V1\Client\ChildPublisherServiceClient;
use Google\Ads\AdManager\V1\ListChildPublishersRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
/**
* @param string $formattedParent The parent, which owns this collection of
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher]s. Format:
* `networks/{network_code}`
* Please see {@see ChildPublisherServiceClient::networkName()} for help formatting this field.
*/
function list_child_publishers_sample(string $formattedParent): void
{
// Create a client.
$childPublisherServiceClient = new ChildPublisherServiceClient();
// Prepare the request message.
$request = (new ListChildPublishersRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $childPublisherServiceClient->listChildPublishers($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 = ChildPublisherServiceClient::networkName('[NETWORK_CODE]');
list_child_publishers_sample($formattedParent);
}
updateChildPublisher
Updates a ChildPublisher object.
The async variant is ChildPublisherServiceClient::updateChildPublisherAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\UpdateChildPublisherRequest
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\ChildPublisher |
|
use Google\Ads\AdManager\V1\ChildPublisher;
use Google\Ads\AdManager\V1\Client\ChildPublisherServiceClient;
use Google\Ads\AdManager\V1\DelegationTypeEnum\DelegationType;
use Google\Ads\AdManager\V1\UpdateChildPublisherRequest;
use Google\ApiCore\ApiException;
/**
* @param string $childPublisherDisplayName The display name of the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher].
* @param string $childPublisherEmail The email for the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher].
* @param int $childPublisherDelegationType The type of delegation for the
* [ChildPublisher][google.ads.admanager.v1.ChildPublisher].
*
* This attribute is immutable while the relationship is active.
*/
function update_child_publisher_sample(
string $childPublisherDisplayName,
string $childPublisherEmail,
int $childPublisherDelegationType
): void {
// Create a client.
$childPublisherServiceClient = new ChildPublisherServiceClient();
// Prepare the request message.
$childPublisher = (new ChildPublisher())
->setDisplayName($childPublisherDisplayName)
->setEmail($childPublisherEmail)
->setDelegationType($childPublisherDelegationType);
$request = (new UpdateChildPublisherRequest())
->setChildPublisher($childPublisher);
// Call the API and handle any network failures.
try {
/** @var ChildPublisher $response */
$response = $childPublisherServiceClient->updateChildPublisher($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
{
$childPublisherDisplayName = '[DISPLAY_NAME]';
$childPublisherEmail = '[EMAIL]';
$childPublisherDelegationType = DelegationType::DELEGATION_TYPE_UNSPECIFIED;
update_child_publisher_sample(
$childPublisherDisplayName,
$childPublisherEmail,
$childPublisherDelegationType
);
}
batchCreateChildPublishersAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\BatchCreateChildPublishersRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchCreateChildPublishersResponse> |
|
batchRejectChildPublishersAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\BatchRejectChildPublishersRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchRejectChildPublishersResponse> |
|
batchRenegotiateChildPublisherAgreementsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\BatchRenegotiateChildPublisherAgreementsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchRenegotiateChildPublisherAgreementsResponse> |
|
batchResendChildPublisherInvitationEmailsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\BatchResendChildPublisherInvitationEmailsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchResendChildPublisherInvitationEmailsResponse> |
|
batchUpdateChildPublishersAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\BatchUpdateChildPublishersRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchUpdateChildPublishersResponse> |
|
batchWithdrawChildPublishersAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\BatchWithdrawChildPublishersRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchWithdrawChildPublishersResponse> |
|
createChildPublisherAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\CreateChildPublisherRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\ChildPublisher> |
|
getChildPublisherAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\GetChildPublisherRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\ChildPublisher> |
|
listChildPublishersAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\ListChildPublishersRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
updateChildPublisherAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Ads\AdManager\V1\UpdateChildPublisherRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\ChildPublisher> |
|
static::childPublisherName
Formats a string containing the fully-qualified path to represent a child_publisher resource.
| Parameters | |
|---|---|
| Name | Description |
networkCode |
string
|
childPublisher |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted child_publisher resource. |
static::networkName
Formats a string containing the fully-qualified path to represent a network resource.
| Parameter | |
|---|---|
| Name | Description |
networkCode |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted network resource. |
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- childPublisher: networks/{network_code}/childPublishers/{child_publisher}
- network: networks/{network_code}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
| Parameters | |
|---|---|
| Name | Description |
formattedName |
string
The formatted name string |
template |
?string
Optional name of template to match |
| Returns | |
|---|---|
| Type | Description |
array |
An associative array from name component IDs to component values. |