class Users in Instagram API 8
Class Users.
@package Drupal\instagram_api\Service
Hierarchy
- class \Drupal\instagram_api\Service\Users
Expanded class hierarchy of Users
1 string reference to 'Users'
1 service uses Users
File
- src/
Service/ Users.php, line 12
Namespace
Drupal\instagram_api\ServiceView source
class Users {
/**
* 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;
}
/**
* Get information about the owner of the access_token.
*
* @param bool $cacheable
* Cacheable.
*
* @return array|bool
* Response array.
* https://api.instagram.com/v1/users/self/?access_token=ACCESS-TOKEN
*
* @see https://www.instagram.com/developer/endpoints/users/#get_users_self
*/
public function getSelf($cacheable = TRUE) {
$response = $this->client
->request('users/self', [], $cacheable);
if ($response) {
return $response;
}
return FALSE;
}
/**
* Get the most recent media published by the owner of the access_token.
*
* @param array $args
* Args, see API docs for options.
* @param bool $cacheable
* Cacheable.
*
* @return array|bool
* Response array.
* https://api.instagram.com/v1/users/self/?access_token=ACCESS-TOKEN
*
* @see https://www.instagram.com/developer/endpoints/users/#get_users_self
*/
public function getSelfMediaRecent(array $args = [], $cacheable = TRUE) {
$response = $this->client
->request('users/self/media/recent', $args, $cacheable);
if ($response) {
return $response;
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Users:: |
protected | property | Client. | |
Users:: |
protected | property | Logger Factory. | |
Users:: |
public | function | Get information about the owner of the access_token. | |
Users:: |
public | function | Get the most recent media published by the owner of the access_token. | |
Users:: |
public | function | Media constructor. |