class Media in Instagram API 8
Class Media.
@package Drupal\instagram_api\Service
Hierarchy
- class \Drupal\instagram_api\Service\Media
Expanded class hierarchy of Media
2 string references to 'Media'
1 service uses Media
File
- src/
Service/ Media.php, line 12
Namespace
Drupal\instagram_api\ServiceView source
class Media {
/**
* Client.
*
* @var \Drupal\instagram_api\Service\Client
*/
protected $client;
/**
* Logger Factory.
*
* @var \Drupal\Core\Logger\LoggerChannelFactoryInterface
*/
protected $loggerFactory;
/**
* Media constructor.
*
* @param \Drupal\instagram_api\Service\Client $client
* Client.
* @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $loggerFactory
* LoggerChannelFactory.
*/
public function __construct(Client $client, LoggerChannelFactoryInterface $loggerFactory) {
// Instagram API Client.
$this->client = $client;
$this->loggerFactory = $loggerFactory;
}
/**
* Search for recent media in a given area.
*
* @param string $lat
* Lat.
* @param string $lng
* Lng.
* @param string $distance
* Dist.
* @param bool $cacheable
* Cacheable.
*
* @return array|bool
* Response array.
* https://api.instagram.com/v1/media/search?lat=48.858844&lng=2.294351&access_token=ACCESS-TOKEN
*
* @see https://www.instagram.com/developer/endpoints/media/
*/
public function mediaSearch($lat, $lng, $distance = 1, $cacheable = TRUE) {
$response = $this->client
->request('media/search', [
'lat' => $lat,
'lng' => $lng,
'distance' => $distance,
], $cacheable);
if ($response) {
return $response;
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Media:: |
protected | property | Client. | |
Media:: |
protected | property | Logger Factory. | |
Media:: |
public | function | Search for recent media in a given area. | |
Media:: |
public | function | Media constructor. |