\Google\AdsApi\CommonAdsGuzzleHttpClientFactory

Creates a Guzzle HTTP client for making non-SOAP HTTP calls, e.g., report download for AdWords and Dfp by pushing the logging middleware to the handler stacks of all generated clients.

Summary

Methods
Properties
Constants
__construct()
generateHttpClient()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$logger
$messageFormatter
$config
N/A

Properties

$logger

$logger :

Type

$messageFormatter

$messageFormatter :

Type

$config

$config :

Type

Methods

__construct()

__construct(\Psr\Log\LoggerInterface  $logger,\Google\AdsApi\Common\GuzzleLogMessageFormatter  $messageFormatter,\GuzzleHttp\Client|null  $httpClient = null)

Creates a new instance of this factory by specifying the logger for all generated HTTP clients.

Parameters

\Psr\Log\LoggerInterface $logger

the logger for the generated HTTP clients

\Google\AdsApi\Common\GuzzleLogMessageFormatter $messageFormatter

the Guzzle log message formatter

\GuzzleHttp\Client|null $httpClient

the user-provided HTTP client

generateHttpClient()

generateHttpClient(): \GuzzleHttp\Client

Generates a Guzzle HTTP client for making HTTP calls by using configs of the user-provided client. This method adds the logging middleware required by this library to the handler stack of the generated client.

Returns

\GuzzleHttp\Client —

the Guzzle HTTP client