You are here

public function Client::__construct in Instagram API 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\Logger\LoggerChannelFactoryInterface $loggerFactory: LoggerChannelFactory.

File

src/Service/Client.php, line 57

Class

Client
Class Client.

Namespace

Drupal\instagram_api\Service

Code

public function __construct(ConfigFactory $config, CacheBackendInterface $cacheBackend, TranslationInterface $stringTranslation, LoggerChannelFactoryInterface $loggerFactory) {

  // Get the config.
  $this->config = $config
    ->get('instagram_api.settings');

  // Cache Backend.
  $this->cacheBackend = $cacheBackend;

  // String Translation.
  $this->stringTranslation = $stringTranslation;
  $this->api_base_uri = $this->config
    ->get('api_base_uri');
  $this->api_cache_maximum_age = $this->config
    ->get('api_cache_maximum_age');
  $this->access_token = $this->config
    ->get('access_token');
  $this->guzzleClient = new GuzzleClient([
    'base_uri' => $this->api_base_uri,
  ]);
  $this->loggerFactory = $loggerFactory;
}