Constants

DEFAULT_USER_AGENT

DEFAULT_USER_AGENT

DEFAULT_ENDPOINT

DEFAULT_ENDPOINT

Properties

$DEFAULT_SOAP_LOGGER_CHANNEL

$DEFAULT_SOAP_LOGGER_CHANNEL :

Type

$DEFAULT_REPORT_DOWNLOADER_LOGGER_CHANNEL

$DEFAULT_REPORT_DOWNLOADER_LOGGER_CHANNEL :

Type

$DEFAULT_BJ_UTIL_LOGGER_CHANNEL

$DEFAULT_BJ_UTIL_LOGGER_CHANNEL :

Type

$adsLoggerFactory

$adsLoggerFactory :

Type

$configurationLoader

$configurationLoader :

Type

$soapSettingsBuilder

$soapSettingsBuilder :

Type

$connectionSettingsBuilder

$connectionSettingsBuilder :

Type

$reportSettingsBuilder

$reportSettingsBuilder :

Type

$developerToken

$developerToken :

Type

$userAgent

$userAgent :

Type

$endpoint

$endpoint :

Type

$oAuth2Credential

$oAuth2Credential :

Type

$soapSettings

$soapSettings :

Type

$connectionSettings

$connectionSettings :

Type

$clientCustomerId

$clientCustomerId :

Type

$isValidateOnly

$isValidateOnly :

Type

$isPartialFailure

$isPartialFailure :

Type

$isIncludeUtilitiesInUserAgent

$isIncludeUtilitiesInUserAgent :

Type

$reportSettings

$reportSettings :

Type

$adsHeaderFormatter

$adsHeaderFormatter :

Type

$soapLogger

$soapLogger :

Type

$reportDownloaderLogger

$reportDownloaderLogger :

Type

$batchJobsUtilLogger

$batchJobsUtilLogger :

Type

Methods

__construct()

__construct()

fromFile()

fromFile(string  $path = null): \Google\AdsApi\AdWords\AdWordsSessionBuilder

Reads configuration settings from the specified filepath. The filepath is optional, and if omitted, it will look for the default configuration filename in the home directory of the user running PHP.

Parameters

string $path

the filepath

Throws

\InvalidArgumentException

if the configuration file could not be found

Returns

\Google\AdsApi\AdWords\AdWordsSessionBuilder

this builder populated from the configuration

withDeveloperToken()

withDeveloperToken(string  $developerToken): \Google\AdsApi\AdWords\AdWordsSessionBuilder

Includes a developer token. This is required.

Parameters

string $developerToken

Returns

\Google\AdsApi\AdWords\AdWordsSessionBuilder

this builder

withUserAgent()

withUserAgent(string  $userAgent): \Google\AdsApi\AdWords\AdWordsSessionBuilder

Includes user agent. This is required.

Parameters

string $userAgent

Returns

\Google\AdsApi\AdWords\AdWordsSessionBuilder

this builder

withEndpoint()

withEndpoint(string|null  $endpoint): \Google\AdsApi\AdWords\AdWordsSessionBuilder

Includes the AdWords API server's base endpoint. This is optional.

Parameters

string|null $endpoint

Returns

\Google\AdsApi\AdWords\AdWordsSessionBuilder

this builder

withOAuth2Credential()

withOAuth2Credential(\Google\Auth\FetchAuthTokenInterface  $oAuth2Credential): \Google\AdsApi\AdWords\AdWordsSessionBuilder

Includes the OAuth2 credential to be used for authentication. This is required.

Parameters

\Google\Auth\FetchAuthTokenInterface $oAuth2Credential

Returns

\Google\AdsApi\AdWords\AdWordsSessionBuilder

this builder

withClientCustomerId()

withClientCustomerId(string|null  $clientCustomerId): \Google\AdsApi\AdWords\AdWordsSessionBuilder

Includes a client customer ID. This is required except when using CustomerService.

Parameters

string|null $clientCustomerId

Returns

\Google\AdsApi\AdWords\AdWordsSessionBuilder

this builder

disableIncludeUtilitiesInUserAgent()

disableIncludeUtilitiesInUserAgent(): \Google\AdsApi\AdWords\AdWordsSessionBuilder

Disables include utilities in user agent option. Enabled by default.

Returns

\Google\AdsApi\AdWords\AdWordsSessionBuilder

this builder

withSoapLogger()

withSoapLogger(\Psr\Log\LoggerInterface|null  $soapLogger): \Google\AdsApi\AdWords\AdWordsSessionBuilder

Includes a PSR-3 compliant logger for logging SOAP calls. This is optional.

Parameters

\Psr\Log\LoggerInterface|null $soapLogger

Returns

\Google\AdsApi\AdWords\AdWordsSessionBuilder

this builder

withReportDownloaderLogger()

withReportDownloaderLogger(\Psr\Log\LoggerInterface|null  $reportDownloaderLogger): \Google\AdsApi\AdWords\AdWordsSessionBuilder

Includes a PSR-3 compliant logger for the report downloader utility to log report download calls. This is optional.

Parameters

\Psr\Log\LoggerInterface|null $reportDownloaderLogger

Returns

\Google\AdsApi\AdWords\AdWordsSessionBuilder

this builder

withBatchJobsUtilLogger()

withBatchJobsUtilLogger(\Psr\Log\LoggerInterface|null  $batchJobsUtilLogger): \Google\AdsApi\AdWords\AdWordsSessionBuilder

Includes a PSR-3 compliant logger for the batch jobs utility to log batch job upload and download calls. This is optional.

Parameters

\Psr\Log\LoggerInterface|null $batchJobsUtilLogger

Returns

\Google\AdsApi\AdWords\AdWordsSessionBuilder

this builder

build()

build(): mixed

Creates a new instance of the data object being populated. This method should call defaultOptionals() and validate().

Returns

mixed —

the data object

defaultOptionals()

defaultOptionals()

Sets all optional fields to their default if they are `null`.

validate()

validate()

Checks that required fields have been included and all included fields are valid (e.g., URIs are valid).

getDeveloperToken()

getDeveloperToken(): string

Gets the developer token.

Returns

string

getUserAgent()

getUserAgent(): string

Gets the user agent.

Returns

string

getEndpoint()

getEndpoint(): string

Gets the endpoint.

Returns

string

getOAuth2Credential()

getOAuth2Credential(): \Google\Auth\FetchAuthTokenInterface

Gets the OAuth2 credential.

Returns

\Google\Auth\FetchAuthTokenInterface

getClientCustomerId()

getClientCustomerId(): string|null

Gets the client customer ID.

Returns

string|null

isValidateOnly()

isValidateOnly(): boolean

If validate only is enabled.

Returns

boolean

isPartialFailure()

isPartialFailure(): boolean

If partial failure is enabled.

Returns

boolean

isIncludeUtilitiesInUserAgent()

isIncludeUtilitiesInUserAgent(): boolean

If include utilities in user agent option is enabled.

Returns

boolean

getSoapLogger()

getSoapLogger(): \Psr\Log\LoggerInterface

Gets the SOAP logger.

Returns

\Psr\Log\LoggerInterface

getReportDownloaderLogger()

getReportDownloaderLogger(): \Psr\Log\LoggerInterface

Gets the report downloader logger.

Returns

\Psr\Log\LoggerInterface

getBatchJobsUtilLogger()

getBatchJobsUtilLogger(): \Psr\Log\LoggerInterface

Gets the batch jobs utility logger.

Returns

\Psr\Log\LoggerInterface