You are here

public function Client::__construct in Flickr API Integration 8

Client constructor.

Parameters

\Drupal\Core\Config\ConfigFactory $config: Config.

\Drupal\Core\Cache\CacheBackendInterface $cacheBackend: Cache backend.

\Drupal\Core\StringTranslation\TranslationInterface $stringTranslation: String translation.

\Drupal\Core\Messenger\MessengerInterface $messenger: The messenger.

File

src/Service/Client.php, line 97

Class

Client
Class Client.

Namespace

Drupal\flickr_api\Service

Code

public function __construct(ConfigFactory $config, CacheBackendInterface $cacheBackend, TranslationInterface $stringTranslation, MessengerInterface $messenger) {
  $this->config = $config
    ->get('flickr_api.settings');
  $this->cacheBackend = $cacheBackend;
  $this->stringTranslation = $stringTranslation;
  $this->messenger = $messenger;
  $this->apiUri = $this->config
    ->get('api_uri');
  $this->hostUri = $this->config
    ->get('host_uri');
  $this->apiKey = $this->config
    ->get('api_key');
  $this->apiSecret = $this->config
    ->get('api_secret');
  $this->apiCacheMaximumAge = $this->config
    ->get('api_cache_maximum_age');
  $this->guzzleClient = new GuzzleClient([
    'base_uri' => $this->apiUri,
  ]);
}