PHP Class Larabros\Elogram\Client

Show file Open project: larabros/elogram Class Usage Examples

Protected Properties

Property Type Description
$container League\Container\ContainerInterface The application IoC container.

Public Methods

Method Description
__construct ( string $clientId, string $clientSecret, string | null $accessToken = null, string $redirectUrl = '', array $options = [] ) Create an instance of :php:class:Client.
comments ( ) : CommentsRepository Returns the current instance of :php:class:CommentsRepository.
getAccessToken ( string $code, string $grant = 'authorization_code' ) : League\OAuth2\Client\Token\AccessToken Sets and returns the access token.
getLoginUrl ( array $options = [] ) : string Gets the login URL.
likes ( ) : LikesRepository Returns the current instance of :php:class:LikesRepository.
locations ( ) : LocationsRepository Returns the current instance of :php:class:LocationsRepository.
media ( ) : MediaRepository Returns the current instance of :php:class:MediaRepository.
paginate ( Response $response, integer | null $limit = null ) : Response Paginates a :php:class:Response.
request ( string $method, string $uri, array $parameters = [] ) : Response Sends a request.
secureRequests ( boolean $enable = true ) : void Enables or disables secure requests by adding or removing SecureRequestMiddleware.
setAccessToken ( League\OAuth2\Client\Token\AccessToken $token ) : void Sets an access token and adds it to AuthMiddleware so the application can make authenticated requests.
tags ( ) : TagsRepository Returns the current instance of :php:class:TagsRepository.
users ( ) : UsersRepository Returns the current instance of :php:class:UsersRepository.

Protected Methods

Method Description
buildContainer ( array $options ) : League\Container\ContainerInterface Takes the constructor parameters and uses them to instantiate and build a Container object.

Method Details

__construct() public method

Create an instance of :php:class:Client.
public __construct ( string $clientId, string $clientSecret, string | null $accessToken = null, string $redirectUrl = '', array $options = [] )
$clientId string
$clientSecret string
$accessToken string | null
$redirectUrl string
$options array

buildContainer() protected method

Takes the constructor parameters and uses them to instantiate and build a Container object.
protected buildContainer ( array $options ) : League\Container\ContainerInterface
$options array
return League\Container\ContainerInterface

comments() public method

Returns the current instance of :php:class:CommentsRepository.
public comments ( ) : CommentsRepository
return Larabros\Elogram\Repositories\CommentsRepository

getAccessToken() public method

Sets and returns the access token.
See also: Elogram\Helpers\RedirectLoginHelper::getAccessToken()
public getAccessToken ( string $code, string $grant = 'authorization_code' ) : League\OAuth2\Client\Token\AccessToken
$code string
$grant string
return League\OAuth2\Client\Token\AccessToken

getLoginUrl() public method

Gets the login URL.
See also: Elogram\Helpers\RedirectLoginHelper::getLoginUrl()
public getLoginUrl ( array $options = [] ) : string
$options array
return string

likes() public method

Returns the current instance of :php:class:LikesRepository.
public likes ( ) : LikesRepository
return Larabros\Elogram\Repositories\LikesRepository

locations() public method

Returns the current instance of :php:class:LocationsRepository.
public locations ( ) : LocationsRepository
return Larabros\Elogram\Repositories\LocationsRepository

media() public method

Returns the current instance of :php:class:MediaRepository.
public media ( ) : MediaRepository
return Larabros\Elogram\Repositories\MediaRepository

paginate() public method

Paginates a :php:class:Response.
See also: Elogram\Http\Clients\AdapterInterface::paginate()
public paginate ( Response $response, integer | null $limit = null ) : Response
$response Larabros\Elogram\Http\Response
$limit integer | null
return Larabros\Elogram\Http\Response

request() public method

Sends a request.
See also: Elogram\Http\Clients\AdapterInterface::request()
public request ( string $method, string $uri, array $parameters = [] ) : Response
$method string
$uri string
$parameters array
return Larabros\Elogram\Http\Response

secureRequests() public method

Enables or disables secure requests by adding or removing SecureRequestMiddleware.
public secureRequests ( boolean $enable = true ) : void
$enable boolean
return void

setAccessToken() public method

Sets an access token and adds it to AuthMiddleware so the application can make authenticated requests.
public setAccessToken ( League\OAuth2\Client\Token\AccessToken $token ) : void
$token League\OAuth2\Client\Token\AccessToken
return void

tags() public method

Returns the current instance of :php:class:TagsRepository.
public tags ( ) : TagsRepository
return Larabros\Elogram\Repositories\TagsRepository

users() public method

Returns the current instance of :php:class:UsersRepository.
public users ( ) : UsersRepository
return Larabros\Elogram\Repositories\UsersRepository

Property Details

$container protected property

The application IoC container.
protected ContainerInterface,League\Container $container
return League\Container\ContainerInterface