PHP Class AdWordsUser, googleads-php-lib

Inheritance: extends AdsUser
Show file Open project: googleads/googleads-php-lib Class Usage Examples

Public Methods

Method Description
GetClientCustomerId ( ) : string Gets the client customer ID for this user.
GetClientLibraryNameAndVersion ( )
GetDefaultOAuth2Handler ( null | string $className = null ) : mixed Get the default OAuth2 Handler for this user.
GetDeveloperToken ( ) : string Gets the developer token for this user.
GetExpressBusinessId ( ) Gets the AdWords Express business ID required for AdWords Express PromotionService
GetExpressPlusPageId ( ) Gets the Google My Business page ID used by AdWords Express PromotionService
GetScopes ( ) : array Gets OAuth2 scopes.
GetService ( string $serviceName, string | null $version = null, string | null $server = null, SoapClientFactory $serviceFactory = null, boolean | null $validateOnly = null, boolean | null $partialFailure = null ) : SoapClient Gets the service by its service name and group.
GetUserAgent ( ) : string Gets the raw user agent for this user.
GetUserAgentHeaderName ( )
LoadService ( string $serviceName, string | null $version = null ) Loads the classes within a service, so they can be used before the service is constructed.
LogAll ( ) Overrides AdsUser::LogAll(), setting an additional log level for report download requests.
LogDefaults ( ) Overrides AdsUser::LogDefaults(), setting an additional log level for report download requests.
LogErrors ( ) Overrides AdsUser::LogErrors(), setting an additional log level for report download requests.
SetClientCustomerId ( string $clientCustomerId ) Sets the client customer ID for this user.
SetDeveloperToken ( string $developerToken ) Sets the developer token for this user.
SetExpressBusinessId ( $businessId ) Sets the AdWords Express business ID required for AdWords Express PromotionService
SetExpressPlusPageId ( $pageId ) Sets the Google My Business page ID used by AdWords Express PromotionService
SetScopes ( $scopes ) Sets OAuth2 scopes.
SetUserAgent ( string $userAgent ) Sets the raw user agent for this user.
ValidateUser ( ) Validates the user and throws a validation error if there are any errors.
__call ( string $name, array $arguments ) : mixed Handles calls to undefined methods.
__construct ( string | null $authenticationIniPath = null, string | null $developerToken = null, string | null $userAgent = null, string | null $clientCustomerId = null, string | null $settingsIniPath = null, array | null $oauth2Info = null ) The AdWordsUser constructor.

Protected Methods

Method Description
InitLogs ( ) Overrides AdsUser::InitLogs(), adding an additional log for report download requests.

Method Details

GetClientCustomerId() public method

Gets the client customer ID for this user.
public GetClientCustomerId ( ) : string
return string the client customer ID for this user

GetClientLibraryNameAndVersion() public method

See also: AdsUser::GetClientLibraryNameAndVersion()

GetDefaultOAuth2Handler() public method

Get the default OAuth2 Handler for this user.
public GetDefaultOAuth2Handler ( null | string $className = null ) : mixed
$className null | string the name of the oauth2Handler class or null
return mixed the configured OAuth2Handler class

GetDeveloperToken() public method

Gets the developer token for this user.
public GetDeveloperToken ( ) : string
return string the developer token

GetExpressBusinessId() public method

Gets the AdWords Express business ID required for AdWords Express PromotionService

GetExpressPlusPageId() public method

Gets the Google My Business page ID used by AdWords Express PromotionService

GetScopes() public method

Gets OAuth2 scopes.
public GetScopes ( ) : array
return array the list of OAuth2 scopes

GetService() public method

Gets the service by its service name and group.
public GetService ( string $serviceName, string | null $version = null, string | null $server = null, SoapClientFactory $serviceFactory = null, boolean | null $validateOnly = null, boolean | null $partialFailure = null ) : SoapClient
$serviceName string the service name
$version string | null the version of the service to get. If null, then the default version will be used
$server string | null the server to make the request to. If null, then the default server will be used
$serviceFactory SoapClientFactory the factory to create the client. If null, then the built-in SOAP client factory will be used
$validateOnly boolean | null if the service should be created in validateOnly mode
$partialFailure boolean | null if the service should be created in partialFailure mode
return SoapClient the instantiated service

GetUserAgent() public method

Gets the raw user agent for this user.
public GetUserAgent ( ) : string
return string The raw user agent.

GetUserAgentHeaderName() public method

See also: AdsUser::GetUserAgentHeaderName()

InitLogs() protected method

Overrides AdsUser::InitLogs(), adding an additional log for report download requests.
protected InitLogs ( )

LoadService() public method

Loads the classes within a service, so they can be used before the service is constructed.
public LoadService ( string $serviceName, string | null $version = null )
$serviceName string the service name
$version string | null the version of the service to get. If null, then the default version will be used

LogAll() public method

Overrides AdsUser::LogAll(), setting an additional log level for report download requests.
public LogAll ( )

LogDefaults() public method

Overrides AdsUser::LogDefaults(), setting an additional log level for report download requests.
public LogDefaults ( )

LogErrors() public method

Overrides AdsUser::LogErrors(), setting an additional log level for report download requests.
public LogErrors ( )

SetClientCustomerId() public method

Sets the client customer ID for this user.
public SetClientCustomerId ( string $clientCustomerId )
$clientCustomerId string the client customer ID for this user

SetDeveloperToken() public method

Sets the developer token for this user.
public SetDeveloperToken ( string $developerToken )
$developerToken string the developer token

SetExpressBusinessId() public method

Sets the AdWords Express business ID required for AdWords Express PromotionService
public SetExpressBusinessId ( $businessId )

SetExpressPlusPageId() public method

Sets the Google My Business page ID used by AdWords Express PromotionService
public SetExpressPlusPageId ( $pageId )

SetScopes() public method

Sets OAuth2 scopes.
public SetScopes ( $scopes )

SetUserAgent() public method

Sets the raw user agent for this user.
public SetUserAgent ( string $userAgent )
$userAgent string The raw user agent.

ValidateUser() public method

Validates the user and throws a validation error if there are any errors.
public ValidateUser ( )

__call() public method

Handles calls to undefined methods.
public __call ( string $name, array $arguments ) : mixed
$name string the name of the method being called
$arguments array the arguments passed to the method
return mixed the result of the correct method call, or nothing if there is no correct method

__construct() public method

The AdWordsUser class can be configured in one of two ways:

  1. Using an authenitcation INI file
  2. Using supplied credentials

If an authentication INI file is provided and successfully loaded, those values will be used unless a corresponding parameter overwrites it. If the authentication INI file is not provided (e.g. it is null) the class will attempt to load the default authentication file at the path of "../auth.ini" relative to this file's directory. Any corresponding parameter, which is not null, will, however, overwrite any parameter loaded from the default INI.

Likewise, if a custom settings INI file is not provided, the default settings INI file will be loaded from the path of "../settings.ini" relative to this file's directory.

public __construct ( string | null $authenticationIniPath = null, string | null $developerToken = null, string | null $userAgent = null, string | null $clientCustomerId = null, string | null $settingsIniPath = null, array | null $oauth2Info = null )
$authenticationIniPath string | null the absolute path to the authentication INI or relative to the current directory (cwd). If null, the default authentication INI file will attempt to be loaded
$developerToken string | null the developer token (required header). Will overwrite the developer token entry loaded from any INI file
$userAgent string | null the user agent name (required header). Will be prepended with the library name and version. Will overwrite the userAgent entry loaded from any INI file
$clientCustomerId string | null the client customer ID to make the request against (optional header). Will overwrite the clientCustomerId entry loaded from any INI file
$settingsIniPath string | null the path to the settings INI file. If null, the default settings INI file will be loaded
$oauth2Info array | null the OAuth 2.0 information to use for requests